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 TypeMethodDescriptionvoid
addChangeRequestToPendingChanges
(com.portal.pcm.ChangeRequest changeRequest) void
addListener
(SocketChannelListener listener, BRMListener.EventType eventType) Adds a socket channel listener to the list.void
attach
(SocketChannel socketChannel, Object attachment) Adds an attachement to a selection key for the given socket channel.boolean
closeSocketChannel
(SocketChannel socketChannel) Close SocketChannel.getAttachment
(SocketChannel socketChannel) Returns an attachment object on a given socket channel.static PCPSelector
Returns a singleton PCPSelector instance.int
Returns the number of registered SocketChannels.List
<com.portal.pcm.ChangeRequest> boolean
Is selector shutdown.void
process()
void
removeListener
(SocketChannelListener listener) Removes a socket channel listener from the list.void
shutdown()
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)
-