{
int input = JOptionPane.showConfirmDialog( SessionsFrame.this,
"Selecting no will send a notice of disconnect ONLY. "
+ "\nSelecting yes will send both. Cancel will abort unbind.",
"Send graceful disconnect before disconnect notice?", JOptionPane.YES_NO_CANCEL_OPTION );
IoAcceptor acceptor = ( IoAcceptor ) requestor.getService();
List<IoSession> sessions = new ArrayList<IoSession>(
acceptor.getManagedSessions().values() );
if ( input == JOptionPane.CANCEL_OPTION )
{
}
else if ( input == JOptionPane.NO_OPTION )
{
GracefulShutdownHandler.sendNoticeOfDisconnect( sessions, requestor );
acceptor.unbind( requestor.getServiceAddress() );
isServiceBound = false;
unbindItem.setEnabled( isServiceBound );
bindItem.setEnabled( !isServiceBound );
JOptionPane.showMessageDialog( SessionsFrame.this, "Ldap service for "
+ requestor.getLocalAddress() + " has been successfully unbound.", "Success!",
JOptionPane.INFORMATION_MESSAGE );
refresh();
}
else
{
ShutdownDialog dialog = new ShutdownDialog();
setCenteredPosition( SessionsFrame.this, dialog );
dialog.setModal( true );
dialog.setVisible( true );
if ( dialog.isSendCanceled() )
{
LOG.debug( "GracefulShutdown was canceled." );
JOptionPane.showMessageDialog( SessionsFrame.this, "Shutdown has been canceled.",
"Graceful Shutdown Aborted", JOptionPane.OK_OPTION );
return;
}
LOG.debug( "GracefulShutdown parameters captured." );
int timeOffline = dialog.getTimeOffline();
int delay = dialog.getDelay();
GracefulDisconnect graceful = new GracefulDisconnect( timeOffline, delay );
GracefulShutdownHandler.sendGracefulDisconnect( sessions, graceful, requestor );
acceptor.unbind( requestor.getServiceAddress() );
isServiceBound = false;
unbindItem.setEnabled( isServiceBound );
bindItem.setEnabled( !isServiceBound );
// do progress dialog with bypass button to wait for delay time