Java Doc for CachedSocket.java in  » Portal » Open-Portal » com » sun » portal » rproxy » connectionhandler » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.rproxy.connectionhandler 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.portal.rproxy.connectionhandler.CachedSocket

CachedSocket
public class CachedSocket implements TimerClient(Code)
This class defines the behaviour of CachedSockets. CachedSockets maintain a Socket member that is a reference to a Socket or Socket subclass. It defines and maintains the possible states of the socket. CachedSockets are maintained in a SocketCache for reuse. The Socket subclass passed into the CachedSocket constructor is the delegate object. The standard Socket responsibilities are passed to the delegate. Possible states the socket can be in is as follows: IDLE - defines the socket as ready for use ACTIVE - socket is currently in use CLOSED - marked to be closed Member variables _state - the current defined socket state _host - the host address the client socket will connect to _port - the port connected to _inputStream - the CSBufferedInputStream (Cached Socket BufferedInputStream) _socket - the 'real' socket class this CachedSocket represents _timer - starts when the socket is set to an IDLE state. If it times out, the socket deletes itself.
author:
   Kevin Hartig
See Also:   SocketCache
See Also:   CSBufferedInputStream


Field Summary
final public static  intACTIVE
    
final public static  intCLOSED
    
final public static  intIDLE
    

Constructor Summary
public  CachedSocket(Socket socket)
     Constructor for CachedSocket.

Method Summary
public synchronized  voidclose()
    
public  InetAddressgetInetAddress()
     Returns the address to which the socket is connected.
public  CSBufferedInputStreamgetInputStream()
     Get the CSBufferedInputStream associated with this socket.
public  InetAddressgetLocalAddress()
     Gets the local address to which the socket is bound.
public  intgetLocalPort()
     Returns the local port to which this socket is bound.
public  OutputStreamgetOutputStream()
     Returns an output stream for this socket.
public  intgetPort()
     Returns the remote port to which this socket is connected.
public  SocketgetSocket()
    
public  SocketCachegetSocketCache()
     Get the socket cache where this CachedSocket is being stored.
public synchronized  intgetState()
     Return the current socket state.
public  StringgetType()
     Get the type of socket.
public synchronized  voidsetActive()
     Method used to define the socket ACTIVE meaning it's currently in use.
public synchronized  voidsetClosed()
     Method used to mark the socket ready to be closed and cleaned up.
public synchronized  voidsetIdle()
     Method used to define the socket IDLE indicating it's ready for use. Setting to IDLE state causes a timer to be started.
public  voidsetSocketCache(SocketCache socketCache)
     Set a reference to the Socket Cache so a CachedSocket knows how to remove itself from the cache.
public synchronized  voidsetTimeout(int timeout)
     Set the timeout value for the socket.
public  voidsetType(String socketType)
     Set the type of socket represented.
public synchronized  voidtimeOut()
     Implementation of the TimerClient interface method.
public  StringtoString()
     Converts this socket to a String.

Field Detail
ACTIVE
final public static int ACTIVE(Code)



CLOSED
final public static int CLOSED(Code)



IDLE
final public static int IDLE(Code)




Constructor Detail
CachedSocket
public CachedSocket(Socket socket) throws IOException(Code)
Constructor for CachedSocket. It defines the IP address the client socket will connect to and sets the initial state to IDLE. A CachedSocketFactory creates the proper type of Socket subclass to be passed into the CachedSocket constructor.
Parameters:
  socket - Defines the 'real' socket this class represents (the socketdelegate).
exception:
  IOException - throws IOException




Method Detail
close
public synchronized void close() throws IOException(Code)
Closes the socket and Removes the CachedSocket from the SocketCache
exception:
  IOException - throws IOException



getInetAddress
public InetAddress getInetAddress()(Code)
Returns the address to which the socket is connected. the remote IP address to which this socket is connected.



getInputStream
public CSBufferedInputStream getInputStream()(Code)
Get the CSBufferedInputStream associated with this socket. CSBufferedInputStream The input stream associated with thisCachedSocket



getLocalAddress
public InetAddress getLocalAddress()(Code)
Gets the local address to which the socket is bound.



getLocalPort
public int getLocalPort()(Code)
Returns the local port to which this socket is bound.



getOutputStream
public OutputStream getOutputStream() throws IOException(Code)
Returns an output stream for this socket. the local port number to which this socket is connected.
exception:
  IOException - throws IOException



getPort
public int getPort()(Code)
Returns the remote port to which this socket is connected.



getSocket
public Socket getSocket()(Code)



getSocketCache
public SocketCache getSocketCache()(Code)
Get the socket cache where this CachedSocket is being stored. a reference to the SocketCache where this scoket is being stored.



getState
public synchronized int getState()(Code)
Return the current socket state. int Returns the static value representing the current socketstate.



getType
public String getType()(Code)
Get the type of socket.



setActive
public synchronized void setActive()(Code)
Method used to define the socket ACTIVE meaning it's currently in use.



setClosed
public synchronized void setClosed()(Code)
Method used to mark the socket ready to be closed and cleaned up.



setIdle
public synchronized void setIdle()(Code)
Method used to define the socket IDLE indicating it's ready for use. Setting to IDLE state causes a timer to be started. If it times out, this socket will be cleaned up. This method uses the default timeout value set in the CachedSocketFactory.config



setSocketCache
public void setSocketCache(SocketCache socketCache)(Code)
Set a reference to the Socket Cache so a CachedSocket knows how to remove itself from the cache.
Parameters:
  SocketCache - The cache where this CachedSocket is stored.



setTimeout
public synchronized void setTimeout(int timeout)(Code)
Set the timeout value for the socket.
Parameters:
  timeout - The number of seconds the socket can stay alive while idle.



setType
public void setType(String socketType)(Code)
Set the type of socket represented.



timeOut
public synchronized void timeOut()(Code)
Implementation of the TimerClient interface method. If the socket is in the IDLE state and the idle timer expires, this method is called by the expired timer to clean up the socket.



toString
public String toString()(Code)
Converts this socket to a String. For now, just the socket delegate representation. the String representation of the CachedSocket object



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.