ArcGIS Server Geoportal extension
10

com.esri.gpt.catalog.arcims
Class SocketQueue

java.lang.Object
  extended by com.esri.gpt.catalog.arcims.SocketQueue

public class SocketQueue
extends Object

Maintains a collection of socket tokens for ArcIMS metadata server communication.


Constructor Summary
protected SocketQueue(String host, int port, int tokenSize, long waitSeconds, long sleepMillis, long orphanSeconds, String windowsServiceName)
          Constructs the tokens associated with a queue.
 
Method Summary
protected  SocketToken getToken(long startedMillis)
          Gets the next available free token.
protected  boolean hasBusy()
          Returns true if any socket token is in use.
 void onSocketConnectionRefused(int tokenId, String msg, Exception e)
          Call back method on socket connection refused, logs the event and tries to restart windows service
 void onSocketIOException(int tokenId, Exception e)
          Call back method on socket IO Exception
 void onSocketReadException(String msg)
          Call back method on socket wait exceptions
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SocketQueue

protected SocketQueue(String host,
                      int port,
                      int tokenSize,
                      long waitSeconds,
                      long sleepMillis,
                      long orphanSeconds,
                      String windowsServiceName)
Constructs the tokens associated with a queue.

Parameters:
host - the host name
port - the port
tokenSize - the number of tokens to create
waitSeconds - the number of seconds to wait for a token
sleepMillis - the number of milliseconds to sleep while waiting for a token
orphanSeconds - the number of seconds at which a a token in use will be considered orphaned
windowsServiceName - windows service name for running Headless Nik
Method Detail

hasBusy

protected boolean hasBusy()
Returns true if any socket token is in use.

Returns:
_port

getToken

protected SocketToken getToken(long startedMillis)
                        throws SocketWaitException,
                               InterruptedException
Gets the next available free token.

Parameters:
startedMillis - the time at which the client first asked for a token
Returns:
the next available token
Throws:
SocketWaitException - if too long was spent waiting for a token
InterruptedException - if the thread was interrupted while in sleep mode

toString

public String toString()
Returns the string representation of the object.

Overrides:
toString in class Object
Returns:
the string

onSocketConnectionRefused

public void onSocketConnectionRefused(int tokenId,
                                      String msg,
                                      Exception e)
Call back method on socket connection refused, logs the event and tries to restart windows service

Parameters:
tokenId - the socket token identifier
msg - the error message
e - the exception object
Throws:
ApplicationException

onSocketReadException

public void onSocketReadException(String msg)
Call back method on socket wait exceptions


onSocketIOException

public void onSocketIOException(int tokenId,
                                Exception e)
Call back method on socket IO Exception


ArcGIS Server Geoportal extension
10

Copyright 2010 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.