001/* 002 * Copyright 2009 Red Hat, Inc. 003 * Red Hat licenses this file to you under the Apache License, version 004 * 2.0 (the "License"); you may not use this file except in compliance 005 * with the License. You may obtain a copy of the License at 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * Unless required by applicable law or agreed to in writing, software 008 * distributed under the License is distributed on an "AS IS" BASIS, 009 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 010 * implied. See the License for the specific language governing 011 * permissions and limitations under the License. 012 */ 013package org.hornetq.spi.core.remoting; 014 015import org.hornetq.api.core.HornetQException; 016import org.hornetq.spi.core.protocol.ProtocolType; 017 018/** 019 * A ConnectionLifeCycleListener is called by the remoting implementation to notify of connection events. 020 * 021 * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a> 022 */ 023public interface ConnectionLifeCycleListener 024{ 025 /** 026 * This method is used both by client connector creation and server connection creation through acceptors. 027 * the acceptor will be set to null on client operations 028 * 029 * @param The acceptor here will be always null on a client connection created event. 030 * @param connection the connection that has been created 031 */ 032 void connectionCreated(Acceptor acceptor, Connection connection, ProtocolType protocol); 033 034 /** 035 * called when a connection is destroyed. 036 * 037 * @param connectionID the connection being destroyed. 038 */ 039 void connectionDestroyed(Object connectionID); 040 041 042 /** 043 * called when an error occurs on the connection. 044 * 045 * @param connectionID the id of the connection. 046 * @param me the exception. 047 */ 048 void connectionException(Object connectionID, HornetQException me); 049 050 void connectionReadyForWrites(Object connectionID, boolean ready); 051}