/*
 * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0, which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 *
 * This Source Code may also be made available under the following Secondary
 * Licenses when the conditions for such availability set forth in the
 * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
 * version 2 with the GNU Classpath Exception, which is available at
 * https://www.gnu.org/software/classpath/license.html.
 *
 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
 */

package org.glassfish.grizzly;

Monitoring probe providing callbacks that may be invoked by Grizzly Connection implementations.
Author:Alexey Stashok
Since:2.0
/** * Monitoring probe providing callbacks that may be invoked by Grizzly * {@link Connection} implementations. * * @author Alexey Stashok * * @since 2.0 */
public interface ConnectionProbe {
Method will be called, when server side connection gets bound.
Params:
/** * Method will be called, when server side connection gets bound. * * @param connection {@link Connection}, the event belongs to. */
void onBindEvent(Connection connection);
Method will be called, when server side connection gets accepted.
Params:
  • serverConnection – server Connection, the event belongs to.
  • clientConnection – new client Connection.
/** * Method will be called, when server side connection gets accepted. * * @param serverConnection server {@link Connection}, the event belongs to. * @param clientConnection new client {@link Connection}. */
void onAcceptEvent(Connection serverConnection, Connection clientConnection);
Method will be called, when client side connection gets connected (opened).
Params:
/** * Method will be called, when client side connection gets connected (opened). * * @param connection {@link Connection}, the event belongs to. */
void onConnectEvent(Connection connection);
Method will be called, when the Connection has read data.
Params:
  • connection – Connection, the event belongs to.
  • data – Buffer, where the data gets read.
  • size – the data size.
/** * Method will be called, when the {@link Connection} has read data. * * @param connection {@link Connection}, the event belongs to. * @param data {@link Buffer}, where the data gets read. * @param size the data size. */
void onReadEvent(Connection connection, Buffer data, int size);
Method will be called, when the Connection has written data.
Params:
  • connection – Connection, the event belongs to.
  • data – Buffer, where the data gets writen.
  • size – the data size.
/** * Method will be called, when the {@link Connection} has written data. * * @param connection {@link Connection}, the event belongs to. * @param data {@link Buffer}, where the data gets writen. * @param size the data size. */
void onWriteEvent(Connection connection, Buffer data, long size);
Method will be called, when error occurs on the Connection.
Params:
  • connection – Connection, the event belongs to.
  • error – error
/** * Method will be called, when error occurs on the {@link Connection}. * * @param connection {@link Connection}, the event belongs to. * @param error error */
void onErrorEvent(Connection connection, Throwable error);
Method will be called, when Connection gets closed.
Params:
/** * Method will be called, when {@link Connection} gets closed. * * @param connection {@link Connection}, the event belongs to. */
void onCloseEvent(Connection connection);
Method will be called, when IOEvent for the specific Connection gets ready.
Params:
/** * Method will be called, when {@link IOEvent} for the specific * {@link Connection} gets ready. * * @param connection {@link Connection}, the event belongs to. * @param ioEvent {@link IOEvent}. */
void onIOEventReadyEvent(Connection connection, IOEvent ioEvent);
Method will be called, when IOEvent for the specific Connection gets enabled.
Params:
/** * Method will be called, when {@link IOEvent} for the specific * {@link Connection} gets enabled. * * @param connection {@link Connection}, the event belongs to. * @param ioEvent {@link IOEvent}. */
void onIOEventEnableEvent(Connection connection, IOEvent ioEvent);
Method will be called, when IOEvent for the specific Connection gets disabled.
Params:
/** * Method will be called, when {@link IOEvent} for the specific * {@link Connection} gets disabled. * * @param connection {@link Connection}, the event belongs to. * @param ioEvent {@link IOEvent}. */
void onIOEventDisableEvent(Connection connection, IOEvent ioEvent); // ---------------------------------------------------------- Nested Classes
ConnectionProbe adapter that provides no-op implementations for all interface methods allowing easy extension by the developer.
Since:2.1.9
/** * {@link ConnectionProbe} adapter that provides no-op implementations for * all interface methods allowing easy extension by the developer. * * @since 2.1.9 */
@SuppressWarnings("UnusedDeclaration") class Adapter implements ConnectionProbe { // ---------------------------------------- Methods from ConnectionProbe
{@inheritDoc}
/** * {@inheritDoc} */
@Override public void onBindEvent(Connection connection) {}
{@inheritDoc}
/** * {@inheritDoc} */
@Override public void onAcceptEvent(Connection serverConnection, Connection clientConnection) {}
{@inheritDoc}
/** * {@inheritDoc} */
@Override public void onConnectEvent(Connection connection) {}
{@inheritDoc}
/** * {@inheritDoc} */
@Override public void onReadEvent(Connection connection, Buffer data, int size) {}
{@inheritDoc}
/** * {@inheritDoc} */
@Override public void onWriteEvent(Connection connection, Buffer data, long size) {}
{@inheritDoc}
/** * {@inheritDoc} */
@Override public void onErrorEvent(Connection connection, Throwable error) {}
{@inheritDoc}
/** * {@inheritDoc} */
@Override public void onCloseEvent(Connection connection) {}
{@inheritDoc}
/** * {@inheritDoc} */
@Override public void onIOEventReadyEvent(Connection connection, IOEvent ioEvent) {}
{@inheritDoc}
/** * {@inheritDoc} */
@Override public void onIOEventEnableEvent(Connection connection, IOEvent ioEvent) {}
{@inheritDoc}
/** * {@inheritDoc} */
@Override public void onIOEventDisableEvent(Connection connection, IOEvent ioEvent) {} } // END Adapter }