[jboss-cvs] JBoss Messaging SVN: r4048 - in trunk/src/main/org/jboss/messaging/core/server: impl and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 14 10:39:11 EDT 2008


Author: timfox
Date: 2008-04-14 10:39:11 -0400 (Mon, 14 Apr 2008)
New Revision: 4048

Added:
   trunk/src/main/org/jboss/messaging/core/server/ObjectIDGenerator.java
   trunk/src/main/org/jboss/messaging/core/server/impl/ObjectIDGeneratorImpl.java
Log:
Added missing files


Added: trunk/src/main/org/jboss/messaging/core/server/ObjectIDGenerator.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/ObjectIDGenerator.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/server/ObjectIDGenerator.java	2008-04-14 14:39:11 UTC (rev 4048)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core.server;
+
+/**
+ * 
+ * A ObjectIDGenerator
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public interface ObjectIDGenerator
+{
+	long generateID();
+}

Added: trunk/src/main/org/jboss/messaging/core/server/impl/ObjectIDGeneratorImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ObjectIDGeneratorImpl.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ObjectIDGeneratorImpl.java	2008-04-14 14:39:11 UTC (rev 4048)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core.server.impl;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.jboss.messaging.core.server.ObjectIDGenerator;
+
+/**
+ * 
+ * A ObjectIDGeneratorImpl
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class ObjectIDGeneratorImpl implements ObjectIDGenerator
+{
+   private AtomicLong objectIDGenerator = new AtomicLong(1);
+	
+   public long generateID()
+   {
+   	long id = objectIDGenerator.getAndIncrement();
+   	
+   	if (id == 0)
+   	{
+   		//ID 0 is reserved for the connection factory handler
+   		id = generateID();
+   	}
+   	
+   	return id;
+   }
+
+}




More information about the jboss-cvs-commits mailing list