Platform SDK Java 8.5 API Reference

com.genesyslab.platform.standby
Class WarmStandby

java.lang.Object
  extended by com.genesyslab.platform.standby.WarmStandby

public class WarmStandby
extends java.lang.Object

WarmStandby is used for opening/restoring a channel connection to any endpoint from the pool.


Constructor Summary
WarmStandby(ClientChannel channel, Endpoint... endpoints)
          Creates the new warm stanby instance and defines endpoint pool.
WarmStandby(ClientChannel channel, java.util.List<Endpoint> endpoints)
          Creates the new warm stanby instance and defines endpoints pool.
WarmStandby(java.lang.String name, ClientChannel channel, Endpoint... endpoints)
          Creates the new warm stanby instance and defines endpoint pool.
WarmStandby(java.lang.String name, ClientChannel channel, java.util.List<Endpoint> endpoints)
          Creates the new warm stanby instance and defines endpoints pool.
 
Method Summary
 void autoRestore()
          Enables auto restore and opens asynchronously the channel if it's closed.
 void autoRestore(boolean open)
          Enables auto restore and opens asynchronously the channel if it's needed.
 void close()
          Synchronously closes the channel and stops all WarmStandby's activity.
 java.util.concurrent.Future<java.lang.Void> closeAsync()
          Asynchronously closes the channel and stops all WarmStandby's activity.
<A> void
closeAsync(CompletionHandler<java.lang.Void,A> handler, A attachment)
          Asynchronously closes the channel and stops all WarmStandby's activity.
 ClientChannel getChannel()
          Gets attached channel.
 WSConfig getConfig()
          Gets warmstandby's configuration.
 java.lang.String getName()
          Gets warmStandby name.
 boolean isOpened()
          Checks if the channel state is opened.
 void open()
          Opens synchronously the channel to any available server specified in the configuration.
 java.util.concurrent.Future<ChannelOpenedEvent> openAsync()
          Opens asynchronously the channel to any available server specified in the configuration.
<A> void
openAsync(CompletionHandler<ChannelOpenedEvent,A> handler, A attachment)
          Opens asynchronously the channel to any available server specified in the configuration.
 void setConfig(WSConfig config)
          Applies a new configuration.
 void setHandler(IWSHandler handler)
          Sets a handler.
 void setHandler(WSHandler handler)
          Sets a handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WarmStandby

public WarmStandby(ClientChannel channel,
                   Endpoint... endpoints)
Creates the new warm stanby instance and defines endpoint pool.

Note: if endpoints with same app,host and port will be passed multiple times then only first one will be used while opening.

The iteration through endpoints always starts from the begin of the endpoint pool.
Endpoint from which channel has been disconnected and endpoints which have been already checked unsuccessfully after disconnection, are skipped from the iteration.
If some other order of iteration is desired than in the appropriate event handler (onChannelDisconnected, onEndpointCheckUnsuccessfully, ..) the endpoints order in the pool can be changed appropriately.

Parameters:
channel - that must be attached to the new WarmStandby instance.
endpoints - array of endpoints.
Throws:
java.lang.IllegalArgumentException - if argument channel is null.
java.lang.IllegalArgumentException - if null endpoint occurs.
DisabledMethodException - if the channel has already been attached to another warm standby.

WarmStandby

public WarmStandby(ClientChannel channel,
                   java.util.List<Endpoint> endpoints)
Creates the new warm stanby instance and defines endpoints pool.

Note: if endpoints with same app,host and port will be passed multiple times then only first one will be used while opening.

The iteration through endpoints always starts from the begin of the endpoint pool.
Endpoint from which channel has been disconnected and endpoints which have been already checked unsuccessfully after disconnection, are skipped from the iteration.
If some other order of iteration is desired than in the appropriate event handler (onChannelDisconnected, onEndpointCheckUnsuccessfully, ..) the endpoints order in the pool can be changed appropriately.

Parameters:
channel - that must be attached to the new WarmStandby instance.
endpoints - list of endpoints.
Throws:
java.lang.IllegalArgumentException - if argument channel is null.
java.lang.IllegalArgumentException - if null endpoint occurs.
DisabledMethodException - if the channel has already been attached to another warm standby.

WarmStandby

public WarmStandby(java.lang.String name,
                   ClientChannel channel,
                   Endpoint... endpoints)
Creates the new warm stanby instance and defines endpoint pool.

Note: if endpoints with same app,host and port will be passed multiple times then only first one will be used while opening.

The iteration through endpoints always starts from the begin of the endpoint pool.
Endpoint from which channel has been disconnected and endpoints which have been already checked unsuccessfully after disconnection, are skipped from the iteration.
If some other order of iteration is desired than in the appropriate event handler (onChannelDisconnected, onEndpointCheckUnsuccessfully, ..) the endpoints order in the pool can be changed appropriately.

Parameters:
name - of the warmStandby instance.
channel - that must be attached to the new WarmStandby instance.
endpoints - array of endpoints.
Throws:
java.lang.IllegalArgumentException - if argument channel is null.
java.lang.IllegalArgumentException - if null endpoint occurs.
DisabledMethodException - if the channel has already been attached to another warm standby.

WarmStandby

public WarmStandby(java.lang.String name,
                   ClientChannel channel,
                   java.util.List<Endpoint> endpoints)
Creates the new warm stanby instance and defines endpoints pool.

Note: if endpoints with same app,host and port will be passed multiple times then only first one will be used while opening.

The iteration through endpoints always starts from the begin of the endpoint pool.
Endpoint from which channel has been disconnected and endpoints which have been already checked unsuccessfully after disconnection, are skipped from the iteration.
If some other order of iteration is desired than in the appropriate event handler (onChannelDisconnected, onEndpointCheckUnsuccessfully, ..) the endpoints order in the pool can be changed appropriately.

Parameters:
name - of the warmStandby instance.
channel - that must be attached to the new WarmStandby instance.
endpoints - list of endpoints.
Throws:
java.lang.IllegalArgumentException - if argument channel is null.
java.lang.IllegalArgumentException - if null endpoint occurs.
DisabledMethodException - if the channel has already been attached to another warm standby.
Method Detail

getName

public java.lang.String getName()
Gets warmStandby name.

Returns:
warmStandby name.

getChannel

public ClientChannel getChannel()
Gets attached channel.

Returns:
attached channel.

getConfig

public WSConfig getConfig()
Gets warmstandby's configuration.

Returns:
warmstandby's configuration.

setConfig

public void setConfig(WSConfig config)
Applies a new configuration. All changes have effect on the fly. The

Throws:
java.lang.IllegalArgumentException - if the argument value is null.

isOpened

public boolean isOpened()
Checks if the channel state is opened.

Returns:
true if the channel state is opened.

open

public void open()
          throws java.lang.InterruptedException,
                 WSException
Opens synchronously the channel to any available server specified in the configuration.

This method blocks until the channel is opened, also in the case that channel opening is already in progress.

Do not use directly channel's open/close operations. Use the warmstandby's ones.

Throws:
java.lang.InterruptedException - it can be thrown if the caller thread has been interrupted. It interrupts the waiting for the completion.
WSException - throws as descendant WSCanceledException, WSNoAvailableServersException or WSEmptyEndpointPoolException.
WSNoAvailableServersException - when all endpoints have been checked unsuccessfully.
WSEmptyEndpointPoolException - (descendant of WSNoAvailableServersException) when no any endpoint in the pool.
WSCanceledException - if open operation has been canceled.
java.lang.RuntimeException - when it's called inside warmStandBy handler or completion handler. It prevents from infinite lock.

openAsync

public java.util.concurrent.Future<ChannelOpenedEvent> openAsync()
Opens asynchronously the channel to any available server specified in the configuration.

The future of this method blocks until the channel is opened, also in the case that channel opening is already in progress.

It may be used to continue the connection restoring to the same endpoint inside the event OnEndpointCheckedUnsuccessfully handler when event cause is RegistrationException. To restart the warm standby use close() before.

Do not use directly channel's open/close operations. Use the warmstandby's ones.


openAsync

public <A> void openAsync(CompletionHandler<ChannelOpenedEvent,A> handler,
                          A attachment)
Opens asynchronously the channel to any available server specified in the configuration.

The completion handler is notified about success when the channel is opened, also in the case that channel opening is already in progress.

It may be used to continue the connection restoring to the same endpoint inside the event OnEndpointCheckedUnsuccessfully handler when event cause is RegistrationException. To restart warmStandby use {use openAsync().

Do not use directly channel's open/close operations. Use the warmstandby's ones.

Parameters:
handler - is completion handler.
attachment - that passed to completion handler.

close

public void close()
           throws java.lang.InterruptedException
Synchronously closes the channel and stops all WarmStandby's activity.

It disables auto restore, cancels channel opening and closes the channel synchronously.

Do not use directly channel's open/close operations. Use the warmstandby's ones.

Throws:
java.lang.InterruptedException

closeAsync

public java.util.concurrent.Future<java.lang.Void> closeAsync()
Asynchronously closes the channel and stops all WarmStandby's activity.

It disables auto restore, cancels channel opening and closes the channel asynchronously.

Do not use directly channel's open/close operations. Use the warmstandby's ones.


closeAsync

public <A> void closeAsync(CompletionHandler<java.lang.Void,A> handler,
                           A attachment)
Asynchronously closes the channel and stops all WarmStandby's activity.

It disables auto restore, cancels channel opening and closes the channel asynchronously.

Do not use directly channel's open/close operations. Use the warmstandby's ones.

Parameters:
handler - is completion handler.
attachment - that must be passed to the completion handler.

autoRestore

public void autoRestore()
Enables auto restore and opens asynchronously the channel if it's closed.


autoRestore

public void autoRestore(boolean open)
Enables auto restore and opens asynchronously the channel if it's needed.

Parameters:
open - flag specify if asynchronous channel opening must be initiated if the channel is closed.

setHandler

public void setHandler(WSHandler handler)
Sets a handler.

Parameters:
handler - that will handle the WarmStandby's events.
Throws:
java.lang.IllegalArgumentException - if the argument is null.

setHandler

public void setHandler(IWSHandler handler)
Sets a handler.

Parameters:
handler - that will handle the WarmStandby's events.
Throws:
java.lang.IllegalArgumentException - if the argument is null.

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.