directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r165591 - in /directory/network/trunk/src: examples/org/apache/mina/examples/echoserver/ examples/org/apache/mina/examples/reverser/ java/org/apache/mina/io/filter/ java/org/apache/mina/protocol/filter/ java/org/apache/mina/registry/
Date Mon, 02 May 2005 06:59:51 GMT
Author: trustin
Date: Sun May  1 23:59:50 2005
New Revision: 165591

URL: http://svn.apache.org/viewcvs?rev=165591&view=rev
Log:
Made LoggingFilter a singleton

Modified:
    directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/Main.java
    directory/network/trunk/src/examples/org/apache/mina/examples/reverser/Main.java
    directory/network/trunk/src/java/org/apache/mina/io/filter/IoLoggingFilter.java
    directory/network/trunk/src/java/org/apache/mina/protocol/filter/ProtocolLoggingFilter.java
    directory/network/trunk/src/java/org/apache/mina/registry/ServiceRegistry.java

Modified: directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/Main.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/Main.java?rev=165591&r1=165590&r2=165591&view=diff
==============================================================================
--- directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/Main.java (original)
+++ directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/Main.java Sun
May  1 23:59:50 2005
@@ -73,7 +73,7 @@
     private static void addLogger( ServiceRegistry registry )
     {
         IoAcceptor acceptor = registry.getIoAcceptor( TransportType.SOCKET );
-        acceptor.getFilterChain().addLast( "logger", new IoLoggingFilter() );
+        acceptor.getFilterChain().addLast( "logger", IoLoggingFilter.getInstance() );
         System.out.println( "Logging ON" );
     }
 }

Modified: directory/network/trunk/src/examples/org/apache/mina/examples/reverser/Main.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/examples/org/apache/mina/examples/reverser/Main.java?rev=165591&r1=165590&r2=165591&view=diff
==============================================================================
--- directory/network/trunk/src/examples/org/apache/mina/examples/reverser/Main.java (original)
+++ directory/network/trunk/src/examples/org/apache/mina/examples/reverser/Main.java Sun May
 1 23:59:50 2005
@@ -51,7 +51,7 @@
     private static void addLogger( ServiceRegistry registry )
     {
         ProtocolAcceptor acceptor = registry.getProtocolAcceptor( TransportType.SOCKET );
-        acceptor.getFilterChain().addLast( "logger", new ProtocolLoggingFilter() );
+        acceptor.getFilterChain().addLast( "logger", ProtocolLoggingFilter.getInstance()
);
         System.out.println( "Logging ON" );
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/io/filter/IoLoggingFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/filter/IoLoggingFilter.java?rev=165591&r1=165590&r2=165591&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/filter/IoLoggingFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/filter/IoLoggingFilter.java Sun May
 1 23:59:50 2005
@@ -53,6 +53,23 @@
      */
     public static final String LEVEL = SessionLog.LEVEL;
     
+    private static final IoLoggingFilter INSTANCE = new IoLoggingFilter();
+
+    /**
+     * Returns a logging filter.
+     */
+    public static IoLoggingFilter getInstance()
+    {
+        return INSTANCE;
+    }
+    
+    /**
+     * Creates a new instance.
+     */
+    protected IoLoggingFilter()
+    {
+    }
+    
     public void sessionOpened( NextFilter nextFilter, IoSession session )
     {
         SessionLog.log( session, "OPENED" );

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/filter/ProtocolLoggingFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/filter/ProtocolLoggingFilter.java?rev=165591&r1=165590&r2=165591&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/filter/ProtocolLoggingFilter.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/filter/ProtocolLoggingFilter.java
Sun May  1 23:59:50 2005
@@ -52,6 +52,23 @@
      */
     public static final String LEVEL = SessionLog.LEVEL;
     
+    private static final ProtocolLoggingFilter INSTANCE = new ProtocolLoggingFilter();
+
+    /**
+     * Returns a logging filter.
+     */
+    public static ProtocolLoggingFilter getInstance()
+    {
+        return INSTANCE;
+    }
+    
+    /**
+     * Creates a new instance.
+     */
+    protected ProtocolLoggingFilter()
+    {
+    }
+    
     public void sessionOpened( NextFilter nextFilter, ProtocolSession session )
     {
         SessionLog.log( session, "OPENED" );

Modified: directory/network/trunk/src/java/org/apache/mina/registry/ServiceRegistry.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/registry/ServiceRegistry.java?rev=165591&r1=165590&r2=165591&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/registry/ServiceRegistry.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/registry/ServiceRegistry.java Sun May
 1 23:59:50 2005
@@ -60,10 +60,6 @@
      */
     void unbindAll();
 
-    IoAcceptor getIoAcceptor( TransportType transportType );
-    
-    ProtocolAcceptor getProtocolAcceptor( TransportType transportType );
-
     /**
      * Returns {@link Set} of all services bound in this registry.
      */
@@ -86,4 +82,8 @@
      * specified port number.
      */
     Set getServices(int port);
+
+    IoAcceptor getIoAcceptor( TransportType transportType );
+    
+    ProtocolAcceptor getProtocolAcceptor( TransportType transportType );
 }



Mime
View raw message