EMMA Coverage Report (generated Sat Nov 12 08:39:53 KST 2005)
[all classes][org.apache.mina.protocol.filter]

COVERAGE SUMMARY FOR SOURCE FILE [ProtocolThreadPoolFilter.java]

nameclass, %method, %block, %line, %
ProtocolThreadPoolFilter.java100% (1/1)20%  (2/10)7%   (8/109)11%  (4/38)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProtocolThreadPoolFilter100% (1/1)20%  (2/10)7%   (8/109)11%  (4/38)
exceptionCaught (ProtocolFilter$NextFilter, ProtocolSession, Throwable): void 0%   (0/1)0%   (0/7)0%   (0/2)
filterWrite (ProtocolFilter$NextFilter, ProtocolSession, Object): void 0%   (0/1)0%   (0/5)0%   (0/2)
messageReceived (ProtocolFilter$NextFilter, ProtocolSession, Object): void 0%   (0/1)0%   (0/7)0%   (0/2)
messageSent (ProtocolFilter$NextFilter, ProtocolSession, Object): void 0%   (0/1)0%   (0/7)0%   (0/2)
processEvent (Object, Session, EventType, Object): void 0%   (0/1)0%   (0/54)0%   (0/20)
sessionClosed (ProtocolFilter$NextFilter, ProtocolSession): void 0%   (0/1)0%   (0/7)0%   (0/2)
sessionIdle (ProtocolFilter$NextFilter, ProtocolSession, IdleStatus): void 0%   (0/1)0%   (0/7)0%   (0/2)
sessionOpened (ProtocolFilter$NextFilter, ProtocolSession): void 0%   (0/1)0%   (0/7)0%   (0/2)
ProtocolThreadPoolFilter (): void 100% (1/1)100% (4/4)100% (2/2)
ProtocolThreadPoolFilter (String): void 100% (1/1)100% (4/4)100% (2/2)

1/*
2 *   @(#) $Id: ProtocolThreadPoolFilter.java 332218 2005-11-10 03:52:42Z trustin $
3 *
4 *   Copyright 2004 The Apache Software Foundation
5 *
6 *   Licensed under the Apache License, Version 2.0 (the "License");
7 *   you may not use this file except in compliance with the License.
8 *   You may obtain a copy of the License at
9 *
10 *       http://www.apache.org/licenses/LICENSE-2.0
11 *
12 *   Unless required by applicable law or agreed to in writing, software
13 *   distributed under the License is distributed on an "AS IS" BASIS,
14 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 *   See the License for the specific language governing permissions and
16 *   limitations under the License.
17 *
18 */
19package org.apache.mina.protocol.filter;
20 
21import org.apache.mina.common.IdleStatus;
22import org.apache.mina.common.Session;
23import org.apache.mina.protocol.ProtocolHandler;
24import org.apache.mina.protocol.ProtocolFilter;
25import org.apache.mina.protocol.ProtocolSession;
26import org.apache.mina.util.BaseThreadPool;
27import org.apache.mina.util.EventType;
28import org.apache.mina.util.ThreadPool;
29 
30/**
31 * A Thread-pooling filter.  This filter forwards {@link ProtocolHandler} events
32 * to its thread pool.
33 * 
34 * @author The Apache Directory Project (dev@directory.apache.org)
35 * @version $Rev: 332218 $, $Date: 2005-11-10 12:52:42 +0900 $
36 * 
37 * @see ThreadPool
38 * @see BaseThreadPool
39 */
40public class ProtocolThreadPoolFilter extends BaseThreadPool implements ThreadPool, ProtocolFilter
41{
42 
43    /**
44     * Creates a new instanceof this filter with default thread pool settings.
45     * You'll have to invoke {@link #start()} method to start threads actually.
46     */
47    public ProtocolThreadPoolFilter()
48    {
49        this( "ProtocolThreadPool" );
50    }
51 
52    /**
53     * Creates a new instance of this filter with default thread pool settings.
54     * You'll have to invoke {@link #start()} method to start threads actually.
55     * 
56     * @param threadNamePrefix the prefix of the thread names this pool will create.
57     */
58    public ProtocolThreadPoolFilter( String threadNamePrefix )
59    {
60        super( threadNamePrefix );
61    }
62 
63    public void sessionOpened( NextFilter nextFilter,
64                              ProtocolSession session )
65    {
66        fireEvent( nextFilter, session, EventType.OPENED, null );
67    }
68 
69    public void sessionClosed( NextFilter nextFilter,
70                              ProtocolSession session )
71    {
72        fireEvent( nextFilter, session, EventType.CLOSED, null );
73    }
74 
75    public void sessionIdle( NextFilter nextFilter,
76                            ProtocolSession session, IdleStatus status )
77    {
78        fireEvent( nextFilter, session, EventType.IDLE, status );
79    }
80 
81    public void exceptionCaught( NextFilter nextFilter,
82                                ProtocolSession session, Throwable cause )
83    {
84        fireEvent( nextFilter, session, EventType.EXCEPTION, cause );
85    }
86 
87    public void messageReceived( NextFilter nextFilter,
88                                ProtocolSession session, Object message )
89    {
90        fireEvent( nextFilter, session, EventType.RECEIVED, message );
91    }
92 
93    public void messageSent( NextFilter nextFilter,
94                            ProtocolSession session, Object message )
95    {
96        fireEvent( nextFilter, session, EventType.SENT, message );
97    }
98 
99    protected void processEvent( Object nextFilter0,
100                               Session session0, EventType type,
101                               Object data )
102    {
103        NextFilter nextFilter = ( NextFilter ) nextFilter0;
104        ProtocolSession session = ( ProtocolSession ) session0;
105 
106        if( type == EventType.RECEIVED )
107        {
108            nextFilter.messageReceived( session, data );
109        }
110        else if( type == EventType.SENT )
111        {
112            nextFilter.messageSent( session, data );
113        }
114        else if( type == EventType.EXCEPTION )
115        {
116            nextFilter.exceptionCaught( session, ( Throwable ) data );
117        }
118        else if( type == EventType.IDLE )
119        {
120            nextFilter.sessionIdle( session, ( IdleStatus ) data );
121        }
122        else if( type == EventType.OPENED )
123        {
124            nextFilter.sessionOpened( session );
125        }
126        else if( type == EventType.CLOSED )
127        {
128            nextFilter.sessionClosed( session );
129        }
130    }
131 
132    public void filterWrite( NextFilter nextFilter, ProtocolSession session, Object message )
133    {
134        nextFilter.filterWrite( session, message );
135    }
136}

[all classes][org.apache.mina.protocol.filter]
EMMA 2.0.4217 (C) Vladimir Roubtsov