Package com.portal.pcm
Class PCPSelector
java.lang.Object
com.portal.pcm.PCPSelector
PCP connections socket channel Selector. Used during asynchronous mode of
opcode processing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangeRequestToPendingChanges(com.portal.pcm.ChangeRequest changeRequest) voidaddListener(SocketChannelListener listener, BRMListener.EventType eventType) Adds a socket channel listener to the list.voidattach(SocketChannel socketChannel, Object attachment) Adds an attachement to a selection key for the given socket channel.booleancloseSocketChannel(SocketChannel socketChannel) Close SocketChannel.getAttachment(SocketChannel socketChannel) Returns an attachment object on a given socket channel.static PCPSelectorReturns a singleton PCPSelector instance.intReturns the number of registered SocketChannels.List<com.portal.pcm.ChangeRequest> booleanIs selector shutdown.voidprocess()voidremoveListener(SocketChannelListener listener) Removes a socket channel listener from the list.voidshutdown()Shuts down the selector thread.void
-
Constructor Details
-
PCPSelector
Private constructor.- Throws:
IOException- ex
-
-
Method Details
-
getInstance
Returns a singleton PCPSelector instance.- Returns:
- PCPSelector
- Throws:
IOException- ex
-
addListener
Adds a socket channel listener to the list.- Parameters:
listener- listener to socket channel events.eventType- event type
-
removeListener
Removes a socket channel listener from the list.- Parameters:
listener- listener to socket channel events.
-
shutdown
public void shutdown()Shuts down the selector thread. -
getNumberOfRegisteredChannels
public int getNumberOfRegisteredChannels()Returns the number of registered SocketChannels.- Returns:
- number of registered channels
-
process
public void process() -
closeSocketChannel
Close SocketChannel.- Parameters:
socketChannel- channel to close- Returns:
- channel closed
- Throws:
IOException- ex
-
attach
Adds an attachement to a selection key for the given socket channel.- Parameters:
socketChannel- Socket channelattachment- Attachement object- Throws:
IOException- e
-
getAttachment
Returns an attachment object on a given socket channel.- Parameters:
socketChannel- SocketChannel- Returns:
- Attachment object
-
isShutdown
public boolean isShutdown()Is selector shutdown.- Returns:
- boolean
-
wakeupSelector
public void wakeupSelector() -
getPendingChanges
-
addChangeRequestToPendingChanges
public void addChangeRequestToPendingChanges(com.portal.pcm.ChangeRequest changeRequest)
-