1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.mina.common;
20
21 import org.apache.mina.io.IoSession;
22 import org.apache.mina.io.WriteTimeoutException;
23 import org.apache.mina.io.datagram.DatagramSessionConfig;
24 import org.apache.mina.io.socket.SocketSessionConfig;
25 import org.apache.mina.protocol.ProtocolSession;
26
27 /***
28 * Provides general or {@link TransportType}-specific configuration.
29 * <p>
30 * <ul>
31 * <li><code>idleTime</code> (secs) - <code>sessionIdle</code> event is
32 * enabled if this value is greater than 0.
33 * <li><code>writeTimeout</code> (secs) - {@link WriteTimeoutException} is
34 * thrown when the write buffer of session is full for the specified
35 * time.</li>
36 * </ul>
37 * <p>
38 * Please refer to {@link SocketSessionConfig} and {@link DatagramSessionConfig}
39 * for {@link TransportType}-specific configurations.
40 * <p>
41 * {@link SessionConfig} can be obtained by {@link IoSession#getConfig()} and
42 * by {@link ProtocolSession#getConfig()}. To adjust
43 * {@link TransportType}-specific settings, please downcast it:
44 * <pre>
45 * public void sessionOpened( IoSession s )
46 * {
47 * ( ( SocketSessionConfig ) s.getConfig() ).setReuseAddress( true );
48 * }
49 * </pre>
50 *
51 * @author The Apache Directory Project (dev@directory.apache.org)
52 * @version $Rev: 357871 $, $Date: 2005-12-20 10:56:40 +0900 (Tue, 20 Dec 2005) $
53 */
54 public interface SessionConfig
55 {
56 /***
57 * Returns idle time for the specified type of idleness in seconds.
58 */
59 int getIdleTime( IdleStatus status );
60
61 /***
62 * Returnd idle time for the specified type of idleness in milliseconds.
63 */
64 long getIdleTimeInMillis( IdleStatus status );
65
66 /***
67 * Sets idle time for the specified type of idleness in seconds.
68 */
69 void setIdleTime( IdleStatus status, int idleTime );
70
71 /***
72 * Returns write timeout in seconds.
73 */
74 int getWriteTimeout();
75
76 /***
77 * Returns write timeout in milliseconds.
78 */
79 long getWriteTimeoutInMillis();
80
81 /***
82 * Sets write timeout in seconds.
83 */
84 void setWriteTimeout( int writeTimeout );
85 }