T - the type of read objectspublic class Groups<T> extends Object
At the end you want to read/write from/to any of them.
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.logging.log4j.Logger |
logger |
| Constructor and Description |
|---|
Groups() |
| Modifier and Type | Method and Description |
|---|---|
Groups<T> |
add(org.thales.punch.settings.api.ISettingsMap destination,
NettyTcpClient<T> client)
Add a destination to our groups.
|
boolean |
isActive() |
Groups<T> |
setStartupTimeout(long t)
Set a startup timeout
|
Groups<T> |
setWaitConnectionsTimeout(long t)
Set a wait connection timeout
|
Groups<T> |
start()
Start the group
|
Groups<T> |
start(long startupTimeout,
long connectionTimeout)
Start the groups of destination.
|
void |
stop()
Stop all the groups
|
void |
update()
This method is called whenver a destination to any of the group joins or leaves.
|
boolean |
write(T packet,
Object context)
Write a packet of data to one of the group destination.
|
public Groups<T> add(org.thales.punch.settings.api.ISettingsMap destination, NettyTcpClient<T> client)
You MUST add all your destinations before starting the group.
destination - a new destinationclient - the associated netty clientpublic Groups<T> start(long startupTimeout, long connectionTimeout)
startupTimeout - give some time for the initial connections to be setup. Use this to target the primary group
in the likely case all groups including the primary are up.connectionTimeout - should no connections be available at all in no groups, you can make the
start wait for that amount of time.public void stop()
public Groups<T> setStartupTimeout(long t)
t - the startup timeout in millisecondspublic Groups<T> setWaitConnectionsTimeout(long t)
t - the startup timeout in millisecondspublic void update()
public boolean write(T packet, Object context)
Pay attention to the return code. If false, the group failed to send it to any destination. In that case there will be no upcall to an acker in charge of acknowledging or failing your data upfront. You have to take care of it by yourself.
packet - the data to sendcontext - an object you need back at acknowledgement timepublic boolean isActive()
Copyright © 2023. All rights reserved.