[jboss-cvs] JBoss Messaging SVN: r4568 - trunk/src/main/org/jboss/messaging/util.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 24 04:51:11 EDT 2008


Author: ataylor
Date: 2008-06-24 04:51:11 -0400 (Tue, 24 Jun 2008)
New Revision: 4568

Added:
   trunk/src/main/org/jboss/messaging/util/MessagingBufferFactoryImpl.java
Log:
added second failure listener to handle cleanup at the core level not JMS. ALso made MesagingBufferFactory an interface

Copied: trunk/src/main/org/jboss/messaging/util/MessagingBufferFactoryImpl.java (from rev 4566, trunk/src/main/org/jboss/messaging/util/MessagingBufferFactory.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/util/MessagingBufferFactoryImpl.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/util/MessagingBufferFactoryImpl.java	2008-06-24 08:51:11 UTC (rev 4568)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.util;
+
+import org.jboss.messaging.core.remoting.TransportType;
+import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
+
+import java.nio.ByteBuffer;
+
+/**
+ * a factory class for creating an appropriate type of MessagingBuffer.
+ * 
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class MessagingBufferFactoryImpl implements MessagingBufferFactory
+{
+   public MessagingBuffer createMessagingBuffer(TransportType transportType, int len)
+   {
+      if (transportType == TransportType.TCP)
+      {
+         return new IoBufferWrapper(len);
+      }
+      else if(transportType == TransportType.INVM)
+      {
+         return new ByteBufferWrapper(ByteBuffer.allocate(len));
+      }
+      else
+      {
+         throw new IllegalArgumentException("No Messaging Buffer for transport");
+      }
+   }
+}




More information about the jboss-cvs-commits mailing list