com.notuvy.singleapp.multiuser
Class MultiUserSingleAppEnforcer
java.lang.Object
com.notuvy.singleapp.multiuser.GenericEnforcer
com.notuvy.singleapp.multiuser.MultiUserSingleAppEnforcer
- All Implemented Interfaces:
- Enforcer
- Direct Known Subclasses:
- MultiUserDefer, MultiUserPreempt
public abstract class MultiUserSingleAppEnforcer
- extends GenericEnforcer
- implements Enforcer
A utility that enforces the invocation of a single application instance.
- Author:
- murali
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG
protected static final org.apache.log4j.Logger LOG
MSG_TYPE_DEFER_MESSAGE
protected static final int MSG_TYPE_DEFER_MESSAGE
- See Also:
- Constant Field Values
MSG_TYPE_PREEMPT_MESSAGE
protected static final int MSG_TYPE_PREEMPT_MESSAGE
- See Also:
- Constant Field Values
MSG_TYPE_PREEMPT_ACK
protected static final int MSG_TYPE_PREEMPT_ACK
- See Also:
- Constant Field Values
MSG_TYPE_PING
protected static final int MSG_TYPE_PING
- See Also:
- Constant Field Values
TEST_USER_NAME
public static final String TEST_USER_NAME
- See Also:
- Constant Field Values
fUserMap
protected Map<String,BrokerConnection> fUserMap
fClientConnection
protected BrokerConnection fClientConnection
MultiUserSingleAppEnforcer
protected MultiUserSingleAppEnforcer(int pPort,
Runnable pRunnable)
getPort
public int getPort()
getUser
public String getUser()
getServer
protected ServerSocket getServer()
setServer
protected void setServer(ServerSocket pServer)
reattempt
protected void reattempt()
alreadyHaveInstanceForUser
protected boolean alreadyHaveInstanceForUser(BrokerConnection pIncomingConnection)
handlePing
protected void handlePing()
throws IOException
- Throws:
IOException
startBrokerClientListener
protected void startBrokerClientListener(BrokerConnection pBrokerConnection,
Runnable pListener)
attempt
public void attempt()
- Specified by:
attempt
in interface Enforcer
handlePortConflict
protected abstract void handlePortConflict()
- If a conflict with an existing broker happens, define how to proceed.
handleConnection
protected abstract void handleConnection(Socket pSocket)
- When the first instance receives a socket connection, handle it.
- Parameters:
pSocket
- The socket with the new incoming connection.
handleRelayedMessage
protected abstract void handleRelayedMessage()
throws IOException
- Handle the message relayed from the broker.
- Throws:
IOException
shutdownServer
public void shutdownServer()
- Specified by:
shutdownServer
in interface Enforcer
Copyright © 2012. All Rights Reserved.