directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 56562 - incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/server/udp
Date Thu, 04 Nov 2004 03:53:55 GMT
Author: akarasulu
Date: Wed Nov  3 19:53:55 2004
New Revision: 56562

Modified:
   incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/server/udp/Main.java
Log:
runnable instead of extending Thread

Modified: incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/server/udp/Main.java
==============================================================================
--- incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/server/udp/Main.java
(original)
+++ incubator/directory/kerberos/trunk/kerberos/src/java/org/apache/kerberos/kdc/server/udp/Main.java
Wed Nov  3 19:53:55 2004
@@ -16,57 +16,79 @@
  */
 package org.apache.kerberos.kdc.server.udp;
 
-import org.apache.kerberos.kdc.*;
-import org.apache.kerberos.kdc.store.*;
 
-import java.io.*;
-import java.net.*;
-
-public class Main {
-
-	private static final KdcConfiguration config  = new KdcConfiguration();
-	private static final BootstrapStore bootstrap = new BootstrapStore(config);
-	private static final PrincipalStore ldap      = new LdapStore(config, bootstrap);
-	private static final KdcDispatcher kdc        = new KdcDispatcher(config, bootstrap, ldap);
-	
-	public static void main(String[] args) {
-		Main m = new Main();
-		m.go();
-	}
-
-	private void go() {
-		
-		init();
-		
-		DatagramSocket socket = null;
-		try {
-			socket = new DatagramSocket(config.getDefaultPort());
-
-			while (true) {
-				byte[] requestBytes = new byte[config.getBufferSize()];
-
-				DatagramPacket packet = new DatagramPacket(requestBytes, requestBytes.length);
-				socket.receive(packet);
-				
-				Thread worker = new Thread(new Connection(socket, packet, kdc));
-				worker.start();
-			}
-		} catch (IOException ioe) {
-			ioe.printStackTrace();
-		} finally {
-			if (socket != null)
-				socket.close();
-		}
-	}
-	
-	private void init() {
-		Thread storeInit = new Thread() {
-			public void run() {
-				bootstrap.init();
-				ldap.init();
-			}
-		};
-		storeInit.start();
-	}
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+
+import org.apache.kerberos.kdc.KdcConfiguration;
+import org.apache.kerberos.kdc.KdcDispatcher;
+import org.apache.kerberos.kdc.store.BootstrapStore;
+import org.apache.kerberos.kdc.store.LdapStore;
+import org.apache.kerberos.kdc.store.PrincipalStore;
+
+
+public class Main
+{
+    private static final KdcConfiguration config = new KdcConfiguration();
+    private static final BootstrapStore bootstrap = new BootstrapStore( config );
+    private static final PrincipalStore ldap = new LdapStore( config, bootstrap );
+    private static final KdcDispatcher kdc = new KdcDispatcher( config, bootstrap, ldap );
+
+
+    public static void main( String[] args )
+    {
+        Main m = new Main();
+        m.go();
+    }
+
+
+    private void go()
+    {
+        init();
+
+        DatagramSocket socket = null;
+        try
+        {
+            socket = new DatagramSocket( config.getDefaultPort() );
+
+            while ( true )
+            {
+                byte[] requestBytes = new byte[config.getBufferSize()];
+
+                DatagramPacket packet = new DatagramPacket( requestBytes, requestBytes.length
);
+                socket.receive( packet );
+
+                Thread worker = new Thread( new Connection( socket, packet, kdc ) );
+                worker.start();
+            }
+        }
+        catch ( IOException ioe )
+        {
+            ioe.printStackTrace();
+        }
+        finally
+        {
+            if ( socket != null )
+            {
+                socket.close();
+            }
+        }
+    }
+
+
+    private void init()
+    {
+        Runnable runnable = new Runnable()
+        {
+            public void run()
+            {
+                bootstrap.init();
+                ldap.init();
+            }
+        };
+        Thread storeInit = new Thread( runnable );
+        storeInit.start();
+    }
 }
 

Mime
View raw message