JBoss hornetq SVN: r12206 - trunk/hornetq-core/src/main/java/org/hornetq/core/config.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-27 10:05:24 -0500 (Mon, 27 Feb 2012)
New Revision: 12206
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/config/Configuration.java
Log:
improve javadocs.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/config/Configuration.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/config/Configuration.java 2012-02-27 15:05:01 UTC (rev 12205)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/config/Configuration.java 2012-02-27 15:05:24 UTC (rev 12206)
@@ -29,20 +29,20 @@
import org.hornetq.spi.core.logging.LogDelegateFactory;
/**
- *
+ *
* A Configuration is used to configure HornetQ servers.
- *
+ *
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
*
*/
public interface Configuration extends Serializable
{
// General attributes -------------------------------------------------------------------
-
-
+
+
/** To be used on dependency management on the application server */
String getName();
-
+
/** To be used on dependency management on the application server */
void setName(String name);
@@ -59,8 +59,8 @@
void setClustered(boolean clustered);
/**
- * Returns whether a backup will auto die when a live server is failing back
- * @return
+ * Returns whether a backup will auto die when a live server is failing back.
+ * @return {@code true} if the backup will stop when the live server restarts
*/
public boolean isAllowAutoFailBack();
@@ -204,7 +204,7 @@
* Sets whether this server is manageable using JMX or not.
*/
void setJMXManagementEnabled(boolean enabled);
-
+
/**
* Returns the domain used by JMX MBeans (provided JMX management is enabled).
* <br>
@@ -214,7 +214,7 @@
/**
* Sets the domain used by JMX MBeans (provided JMX management is enabled).
- *
+ *
* Changing this JMX domain is required if multiple HornetQ servers are run inside
* the same JVM and all servers are using the same MBeanServer.
*/
@@ -477,12 +477,12 @@
* Sets the file system directory used to store bindings.
*/
void setBindingsDirectory(String dir);
-
+
/** The max number of concurrent reads allowed on paging.
- *
+ *
* Default = 5 */
int getPageMaxConcurrentIO();
-
+
/** The max number of concurrent reads allowed on paging.
* Default = 5 */
void setPageMaxConcurrentIO(int maxIO);
@@ -750,7 +750,7 @@
void setWildcardRoutingEnabled(boolean enabled);
/**
- * Returns the timeout (in milliseconds) after which transactions is removed
+ * Returns the timeout (in milliseconds) after which transactions is removed
* from the resource manager after it was created.
* <br>
* Default value is {@value org.hornetq.core.config.impl.ConfigurationImpl#DEFAULT_TRANSACTION_TIMEOUT}.
@@ -758,7 +758,7 @@
long getTransactionTimeout();
/**
- * Sets the timeout (in milliseconds) after which transactions is removed
+ * Sets the timeout (in milliseconds) after which transactions is removed
* from the resource manager after it was created.
*/
void setTransactionTimeout(long timeout);
@@ -784,7 +784,7 @@
/**
* Sets the sample period to take message counter snapshot.
- *
+ *
* @param period value must be greater than 1000ms
*/
void setMessageCounterSamplePeriod(long period);
@@ -798,13 +798,13 @@
/**
* Sets the maximum number of days kept in memory for message counter.
- *
+ *
* @param maxDayHistory value must be greater than 0
*/
void setMessageCounterMaxDayHistory(int maxDayHistory);
/**
- * Returns the frequency (in milliseconds) to scan transactions to detect which transactions
+ * Returns the frequency (in milliseconds) to scan transactions to detect which transactions
* have timed out.
* <br>
* Default value is {@value org.hornetq.core.config.impl.ConfigurationImpl#DEFAULT_TRANSACTION_TIMEOUT_SCAN_PERIOD}.
@@ -812,13 +812,13 @@
long getTransactionTimeoutScanPeriod();
/**
- * Sets the frequency (in milliseconds) to scan transactions to detect which transactions
+ * Sets the frequency (in milliseconds) to scan transactions to detect which transactions
* have timed out.
*/
void setTransactionTimeoutScanPeriod(long period);
/**
- * Returns the frequency (in milliseconds) to scan messages to detect which messages
+ * Returns the frequency (in milliseconds) to scan messages to detect which messages
* have expired.
* <br>
* Default value is {@value org.hornetq.core.config.impl.ConfigurationImpl#DEFAULT_MESSAGE_EXPIRY_SCAN_PERIOD}.
@@ -826,7 +826,7 @@
long getMessageExpiryScanPeriod();
/**
- * Sets the frequency (in milliseconds) to scan messages to detect which messages
+ * Sets the frequency (in milliseconds) to scan messages to detect which messages
* have expired.
*/
void setMessageExpiryScanPeriod(long messageExpiryScanPeriod);
@@ -844,7 +844,7 @@
void setMessageExpiryThreadPriority(int messageExpiryThreadPriority);
/**
- *
+ *
* @return A list of AddressSettings per matching to be deployed to the address settings repository
*/
Map<String, AddressSettings> getAddressesSettings();
@@ -855,35 +855,35 @@
void setAddressesSettings(Map<String, AddressSettings> addressesSettings);
/**
- *
+ *
* @param roles a list of roles per matching
*/
void setSecurityRoles(Map<String, Set<Role>> roles);
/**
- *
+ *
* @return a list of roles per matching
*/
Map<String, Set<Role>> getSecurityRoles();
/**
- *
- * @param
+ *
+ * @param
*/
void setConnectorServiceConfigurations(List<ConnectorServiceConfiguration> configs);
/**
- *
- * @return
+ *
+ * @return
*/
List<ConnectorServiceConfiguration> getConnectorServiceConfigurations();
- /*
- * how long to wait before failback occurs on restart
- * */
+ /**
+ * Returns the delay to wait before fail-back occurs on restart.
+ */
long getFailbackDelay();
- /*
- * set the failback delay
- * */
+ /**
+ * Sets the fail-back delay.
+ */
void setFailbackDelay(long delay);
}
13 years
JBoss hornetq SVN: r12205 - in trunk/hornetq-core/src/main/java/org/hornetq/core: protocol/core/impl/wireformat and 2 other directories.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-27 10:05:01 -0500 (Mon, 27 Feb 2012)
New Revision: 12205
Added:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeginMessage.java
Removed:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/PacketDecoder.java
trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java
trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
Log:
Fix spelling in class name Being --> BeGin
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/PacketDecoder.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/PacketDecoder.java 2012-02-27 15:04:35 UTC (rev 12204)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/PacketDecoder.java 2012-02-27 15:05:01 UTC (rev 12205)
@@ -110,7 +110,7 @@
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeginMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageEndMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
@@ -481,7 +481,7 @@
}
case REPLICATION_LARGE_MESSAGE_BEGIN:
{
- packet = new ReplicationLargeMessageBeingMessage();
+ packet = new ReplicationLargeMessageBeginMessage();
break;
}
case REPLICATION_LARGE_MESSAGE_END:
Copied: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeginMessage.java (from rev 12204, trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java)
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeginMessage.java (rev 0)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeginMessage.java 2012-02-27 15:05:01 UTC (rev 12205)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.core.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationLargeMessageBeingMessage
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationLargeMessageBeginMessage extends PacketImpl
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ long messageId;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationLargeMessageBeginMessage(final long messageId)
+ {
+ this();
+ this.messageId = messageId;
+ }
+
+ public ReplicationLargeMessageBeginMessage()
+ {
+ super(PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(messageId);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ messageId = buffer.readLong();
+ }
+
+ /**
+ * @return the messageId
+ */
+ public long getMessageId()
+ {
+ return messageId;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java 2012-02-27 15:04:35 UTC (rev 12204)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java 2012-02-27 15:05:01 UTC (rev 12205)
@@ -1,80 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.core.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationLargeMessageBeingMessage
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationLargeMessageBeingMessage extends PacketImpl
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- long messageId;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationLargeMessageBeingMessage(final long messageId)
- {
- this();
- this.messageId = messageId;
- }
-
- public ReplicationLargeMessageBeingMessage()
- {
- super(PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(messageId);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- messageId = buffer.readLong();
- }
-
- /**
- * @return the messageId
- */
- public long getMessageId()
- {
- return messageId;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java 2012-02-27 15:04:35 UTC (rev 12204)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/replication/ReplicationEndpoint.java 2012-02-27 15:05:01 UTC (rev 12205)
@@ -57,7 +57,7 @@
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeginMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageEndMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
@@ -200,7 +200,7 @@
}
else if (type == PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN)
{
- handleLargeMessageBegin((ReplicationLargeMessageBeingMessage) packet);
+ handleLargeMessageBegin((ReplicationLargeMessageBeginMessage) packet);
}
else if (type == PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE)
{
@@ -660,7 +660,7 @@
/**
* @param packet
*/
- private void handleLargeMessageBegin(final ReplicationLargeMessageBeingMessage packet)
+ private void handleLargeMessageBegin(final ReplicationLargeMessageBeginMessage packet)
{
final long id = packet.getMessageId();
createLargeMessage(id, false);
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2012-02-27 15:04:35 UTC (rev 12204)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2012-02-27 15:05:01 UTC (rev 12205)
@@ -48,7 +48,7 @@
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeginMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageEndMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
@@ -258,7 +258,7 @@
{
if (enabled)
{
- sendReplicatePacket(new ReplicationLargeMessageBeingMessage(messageId));
+ sendReplicatePacket(new ReplicationLargeMessageBeginMessage(messageId));
}
}
13 years
JBoss hornetq SVN: r12204 - trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-27 10:04:35 -0500 (Mon, 27 Feb 2012)
New Revision: 12204
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java
Log:
Add hashCode and equals to replication messages
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java 2012-02-27 15:04:14 UTC (rev 12203)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java 2012-02-27 15:04:35 UTC (rev 12204)
@@ -13,9 +13,10 @@
package org.hornetq.core.protocol.core.impl.wireformat;
+import java.util.Arrays;
+
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
@@ -28,12 +29,6 @@
public class ReplicationAddMessage extends PacketImpl
{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(ReplicationAddMessage.class);
-
- // Attributes ----------------------------------------------------
-
private long id;
/** 0 - Bindings, 1 - MessagesJournal */
@@ -132,12 +127,67 @@
return recordData;
}
- // Package protected ---------------------------------------------
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((encodingData == null) ? 0 : encodingData.hashCode());
+ result = prime * result + (int)(id ^ (id >>> 32));
+ result = prime * result + (isUpdate ? 1231 : 1237);
+ result = prime * result + journalID;
+ result = prime * result + Arrays.hashCode(recordData);
+ result = prime * result + recordType;
+ return result;
+ }
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (!super.equals(obj))
+ {
+ return false;
+ }
+ if (!(obj instanceof ReplicationAddMessage))
+ {
+ return false;
+ }
+ ReplicationAddMessage other = (ReplicationAddMessage)obj;
+ if (encodingData == null)
+ {
+ if (other.encodingData != null)
+ {
+ return false;
+ }
+ }
+ else if (!encodingData.equals(other.encodingData))
+ {
+ return false;
+ }
+ if (id != other.id)
+ {
+ return false;
+ }
+ if (isUpdate != other.isUpdate)
+ {
+ return false;
+ }
+ if (journalID != other.journalID)
+ {
+ return false;
+ }
+ if (!Arrays.equals(recordData, other.recordData))
+ {
+ return false;
+ }
+ if (recordType != other.recordType)
+ {
+ return false;
+ }
+ return true;
+ }
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java 2012-02-27 15:04:14 UTC (rev 12203)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java 2012-02-27 15:04:35 UTC (rev 12204)
@@ -13,6 +13,8 @@
package org.hornetq.core.protocol.core.impl.wireformat;
+import java.util.Arrays;
+
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.EncodingSupport;
import org.hornetq.core.protocol.core.impl.PacketImpl;
@@ -140,12 +142,72 @@
return recordData;
}
- // Package protected ---------------------------------------------
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((encodingData == null) ? 0 : encodingData.hashCode());
+ result = prime * result + (int)(id ^ (id >>> 32));
+ result = prime * result + (isUpdate ? 1231 : 1237);
+ result = prime * result + journalID;
+ result = prime * result + Arrays.hashCode(recordData);
+ result = prime * result + recordType;
+ result = prime * result + (int)(txId ^ (txId >>> 32));
+ return result;
+ }
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (!super.equals(obj))
+ {
+ return false;
+ }
+ if (!(obj instanceof ReplicationAddTXMessage))
+ {
+ return false;
+ }
+ ReplicationAddTXMessage other = (ReplicationAddTXMessage)obj;
+ if (encodingData == null)
+ {
+ if (other.encodingData != null)
+ {
+ return false;
+ }
+ }
+ else if (!encodingData.equals(other.encodingData))
+ {
+ return false;
+ }
+ if (id != other.id)
+ {
+ return false;
+ }
+ if (isUpdate != other.isUpdate)
+ {
+ return false;
+ }
+ if (journalID != other.journalID)
+ {
+ return false;
+ }
+ if (!Arrays.equals(recordData, other.recordData))
+ {
+ return false;
+ }
+ if (recordType != other.recordType)
+ {
+ return false;
+ }
+ if (txId != other.txId)
+ {
+ return false;
+ }
+ return true;
+ }
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java 2012-02-27 15:04:14 UTC (rev 12203)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java 2012-02-27 15:04:35 UTC (rev 12204)
@@ -13,6 +13,8 @@
package org.hornetq.core.protocol.core.impl.wireformat;
+import java.util.Arrays;
+
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.EncodingSupport;
import org.hornetq.core.protocol.core.impl.PacketImpl;
@@ -99,12 +101,57 @@
return recordData;
}
- // Package protected ---------------------------------------------
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((encodingData == null) ? 0 : encodingData.hashCode());
+ result = prime * result + journalID;
+ result = prime * result + Arrays.hashCode(recordData);
+ result = prime * result + (int)(txId ^ (txId >>> 32));
+ return result;
+ }
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (!super.equals(obj))
+ {
+ return false;
+ }
+ if (!(obj instanceof ReplicationPrepareMessage))
+ {
+ return false;
+ }
+ ReplicationPrepareMessage other = (ReplicationPrepareMessage)obj;
+ if (encodingData == null)
+ {
+ if (other.encodingData != null)
+ {
+ return false;
+ }
+ }
+ else if (!encodingData.equals(other.encodingData))
+ {
+ return false;
+ }
+ if (journalID != other.journalID)
+ {
+ return false;
+ }
+ if (!Arrays.equals(recordData, other.recordData))
+ {
+ return false;
+ }
+ if (txId != other.txId)
+ {
+ return false;
+ }
+ return true;
+ }
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java 2012-02-27 15:04:14 UTC (rev 12203)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java 2012-02-27 15:04:35 UTC (rev 12204)
@@ -1,6 +1,7 @@
package org.hornetq.core.protocol.core.impl.wireformat;
import java.nio.ByteBuffer;
+import java.util.Arrays;
import java.util.EnumSet;
import java.util.Set;
@@ -182,4 +183,80 @@
{
return pageStoreName;
}
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + Arrays.hashCode(byteArray);
+ result = prime * result + ((byteBuffer == null) ? 0 : byteBuffer.hashCode());
+ result = prime * result + dataSize;
+ result = prime * result + (int)(fileId ^ (fileId >>> 32));
+ result = prime * result + ((fileType == null) ? 0 : fileType.hashCode());
+ result = prime * result + ((journalType == null) ? 0 : journalType.hashCode());
+ result = prime * result + ((pageStoreName == null) ? 0 : pageStoreName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (!super.equals(obj))
+ {
+ return false;
+ }
+ if (!(obj instanceof ReplicationSyncFileMessage))
+ {
+ return false;
+ }
+ ReplicationSyncFileMessage other = (ReplicationSyncFileMessage)obj;
+ if (!Arrays.equals(byteArray, other.byteArray))
+ {
+ return false;
+ }
+ if (byteBuffer == null)
+ {
+ if (other.byteBuffer != null)
+ {
+ return false;
+ }
+ }
+ else if (!byteBuffer.equals(other.byteBuffer))
+ {
+ return false;
+ }
+ if (dataSize != other.dataSize)
+ {
+ return false;
+ }
+ if (fileId != other.fileId)
+ {
+ return false;
+ }
+ if (fileType != other.fileType)
+ {
+ return false;
+ }
+ if (journalType != other.journalType)
+ {
+ return false;
+ }
+ if (pageStoreName == null)
+ {
+ if (other.pageStoreName != null)
+ {
+ return false;
+ }
+ }
+ else if (!pageStoreName.equals(other.pageStoreName))
+ {
+ return false;
+ }
+ return true;
+ }
}
13 years
JBoss hornetq SVN: r12203 - trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-27 10:04:14 -0500 (Mon, 27 Feb 2012)
New Revision: 12203
Modified:
trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
Log:
make fields static
Modified: trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
===================================================================
--- trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2012-02-27 15:03:59 UTC (rev 12202)
+++ trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2012-02-27 15:04:14 UTC (rev 12203)
@@ -52,11 +52,11 @@
// Constants -----------------------------------------------------
- private final byte CF_RECORD = 1;
+ private static final byte CF_RECORD = 1;
- private final byte DESTINATION_RECORD = 2;
+ private static final byte DESTINATION_RECORD = 2;
- private final byte JNDI_RECORD = 3;
+ private static final byte JNDI_RECORD = 3;
// Attributes ----------------------------------------------------
13 years
JBoss hornetq SVN: r12202 - trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-27 10:03:59 -0500 (Mon, 27 Feb 2012)
New Revision: 12202
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/XidImpl.java
Log:
Simplify hashCode calculation.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/XidImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/XidImpl.java 2012-02-27 15:03:44 UTC (rev 12201)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/transaction/impl/XidImpl.java 2012-02-27 15:03:59 UTC (rev 12202)
@@ -14,19 +14,20 @@
package org.hornetq.core.transaction.impl;
import java.io.Serializable;
+import java.util.Arrays;
import javax.transaction.xa.Xid;
import org.hornetq.utils.Base64;
/**
- *
+ *
* Xid implementation
- *
+ *
* @author <a href="mailto:adrian@jboss.org>Adrian Brock</a>
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>
- *
+ *
* @version $Revision 1.1 $
*/
public class XidImpl implements Xid, Serializable
@@ -201,8 +202,7 @@
private void calcHash()
{
byte[] hashBytes = XidImpl.toByteArray(this);
- String s = new String(hashBytes);
- hash = s.hashCode();
+ hash = Arrays.hashCode(hashBytes);
hashCalculated = true;
}
13 years
JBoss hornetq SVN: r12201 - trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-27 10:03:44 -0500 (Mon, 27 Feb 2012)
New Revision: 12201
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java
Log:
clarify behavior when sync'ing large messages
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java 2012-02-27 15:03:25 UTC (rev 12200)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java 2012-02-27 15:03:44 UTC (rev 12201)
@@ -110,6 +110,9 @@
buffer.writeSimpleString(pageStoreName);
break;
}
+ case LARGE_MESSAGE:
+ default:
+ // no-op
}
buffer.writeInt(dataSize);
13 years
JBoss hornetq SVN: r12200 - in trunk: hornetq-journal/src/main/java/org/hornetq/core/journal/impl and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-27 10:03:25 -0500 (Mon, 27 Feb 2012)
New Revision: 12200
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/TransactionCallback.java
Log:
Fix: guard volatile increment against race.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java 2012-02-27 15:03:02 UTC (rev 12199)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java 2012-02-27 15:03:25 UTC (rev 12200)
@@ -27,16 +27,16 @@
import org.hornetq.utils.ExecutorFactory;
/**
- *
+ *
* Each instance of OperationContextImpl is associated with an executor (usually an ordered Executor).
- *
- * Tasks are hold until the operations are complete and executed in the natural order as soon as the operations are returned
+ *
+ * Tasks are hold until the operations are complete and executed in the natural order as soon as the operations are returned
* from replication and storage.
- *
+ *
* If there are no pending IO operations, the tasks are just executed at the callers thread without any context switch.
- *
+ *
* So, if you are doing operations that are not dependent on IO (e.g NonPersistentMessages) you wouldn't have any context switch.
- *
+ *
* @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
*/
public class OperationContextImpl implements OperationContext
@@ -49,12 +49,12 @@
{
OperationContextImpl.threadLocalContext.set(null);
}
-
+
public static OperationContext getContext()
{
return getContext(null);
}
-
+
public static OperationContext getContext(final ExecutorFactory executorFactory)
{
OperationContext token = OperationContextImpl.threadLocalContext.get();
@@ -83,19 +83,17 @@
private int minimalStore = Integer.MAX_VALUE;
private int minimalReplicated = Integer.MAX_VALUE;
-
+
private int minimalPage = Integer.MAX_VALUE;
- private volatile int storeLineUp = 0;
+ private final AtomicInteger storeLineUp = new AtomicInteger(0);
+ private final AtomicInteger replicationLineUp = new AtomicInteger(0);
+ private final AtomicInteger pageLineUp = new AtomicInteger(0);
- private volatile int replicationLineUp = 0;
-
- private volatile int pageLineUp = 0;
-
private int stored = 0;
private int replicated = 0;
-
+
private int paged = 0;
private int errorCode = -1;
@@ -111,12 +109,12 @@
super();
this.executor = executor;
}
-
+
public void pageSyncLineUp()
{
- pageLineUp++;
+ pageLineUp.incrementAndGet();
}
-
+
public synchronized void pageSyncDone()
{
paged++;
@@ -125,12 +123,12 @@
public void storeLineUp()
{
- storeLineUp++;
+ storeLineUp.incrementAndGet();
}
public void replicationLineUp()
{
- replicationLineUp++;
+ replicationLineUp.incrementAndGet();
}
public synchronized void replicationDone()
@@ -154,13 +152,14 @@
if (tasks == null)
{
tasks = new LinkedList<TaskHolder>();
- minimalReplicated = replicationLineUp;
- minimalStore = storeLineUp;
- minimalPage = pageLineUp;
+ minimalReplicated = replicationLineUp.intValue();
+ minimalStore = storeLineUp.intValue();
+ minimalPage = pageLineUp.intValue();
}
// On this case, we can just execute the context directly
- if (replicationLineUp == replicated && storeLineUp == stored && pageLineUp == paged)
+ if (replicationLineUp.intValue() == replicated && storeLineUp.intValue() == stored &&
+ pageLineUp.intValue() == paged)
{
// We want to avoid the executor if everything is complete...
// However, we can't execute the context if there are executions pending
@@ -281,14 +280,9 @@
}
}
- class TaskHolder
+ final class TaskHolder
{
-
-
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
+
@Override
public String toString()
{
@@ -302,19 +296,17 @@
"]";
}
- int storeLined;
+ final int storeLined;
+ final int replicationLined;
+ final int pageLined;
- int replicationLined;
-
- int pageLined;
+ final IOAsyncTask task;
- IOAsyncTask task;
-
TaskHolder(final IOAsyncTask task)
{
- storeLined = storeLineUp;
- replicationLined = replicationLineUp;
- pageLined = pageLineUp;
+ storeLined = storeLineUp.intValue();
+ replicationLined = replicationLineUp.intValue();
+ pageLined = pageLineUp.intValue();
this.task = task;
}
}
@@ -360,7 +352,7 @@
buffer.append("Task = " + hold + "\n");
}
}
-
+
return "OperationContextImpl [minimalStore=" + minimalStore +
", storeLineUp=" +
storeLineUp +
@@ -388,6 +380,6 @@
"]" + buffer.toString();
}
-
+
}
Modified: trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/TransactionCallback.java
===================================================================
--- trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/TransactionCallback.java 2012-02-27 15:03:02 UTC (rev 12199)
+++ trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/TransactionCallback.java 2012-02-27 15:03:25 UTC (rev 12200)
@@ -39,7 +39,10 @@
public void countUp()
{
- up++;
+ synchronized (this)
+ {
+ up++;
+ }
countLatch.countUp();
}
13 years
JBoss hornetq SVN: r12199 - trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-27 10:03:02 -0500 (Mon, 27 Feb 2012)
New Revision: 12199
Modified:
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalFilesRepository.java
Log:
findbugs: check return value (although it should never fail)
Modified: trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalFilesRepository.java
===================================================================
--- trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalFilesRepository.java 2012-02-27 15:02:43 UTC (rev 12198)
+++ trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalFilesRepository.java 2012-02-27 15:03:02 UTC (rev 12199)
@@ -40,7 +40,7 @@
private static final Logger log = Logger.getLogger(JournalFilesRepository.class);
private static final boolean trace = JournalFilesRepository.log.isTraceEnabled();
-
+
// Used to debug the consistency of the journal ordering.
// This is meant to be false as these extra checks would cause performance issues
private static final boolean CHECK_CONSISTENCE = false;
@@ -58,7 +58,7 @@
// Attributes ----------------------------------------------------
private final SequentialFileFactory fileFactory;
-
+
private final JournalImpl journal;
private final BlockingDeque<JournalFile> dataFiles = new LinkedBlockingDeque<JournalFile>();
@@ -82,7 +82,7 @@
private final int userVersion;
private Executor openFilesExecutor;
-
+
private final Runnable pushOpenRunnable = new Runnable()
{
public void run()
@@ -103,7 +103,7 @@
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
-
+
public JournalFilesRepository(final SequentialFileFactory fileFactory,
final JournalImpl journal,
final String filePrefix,
@@ -277,17 +277,17 @@
public void addDataFileOnTop(final JournalFile file)
{
dataFiles.addFirst(file);
-
+
if (CHECK_CONSISTENCE)
{
checkDataFiles();
}
}
-
+
public String debugFiles()
{
StringBuffer buffer = new StringBuffer();
-
+
buffer.append("**********\nCurrent File = " + journal.getCurrentFile() + "\n");
buffer.append("**********\nDataFiles:\n");
for (JournalFile file : dataFiles)
@@ -301,7 +301,7 @@
}
return buffer.toString();
}
-
+
public synchronized void checkDataFiles()
{
long seq = -1;
@@ -314,7 +314,7 @@
log.info("Sequence out of order on journal");
System.exit(-1);
}
-
+
if (journal.getCurrentFile() != null && journal.getCurrentFile().getFileID() <= file.getFileID())
{
log.info("CheckDataFiles:");
@@ -322,18 +322,18 @@
log.info("CurrentFile on the journal is <= the sequence file.getFileID=" + file.getFileID() + " on the dataFiles");
log.info("Currentfile.getFileId=" + journal.getCurrentFile().getFileID() + " while the file.getFileID()=" + file.getFileID());
log.info("IsSame = (" + (journal.getCurrentFile() == file) + ")");
-
+
// throw new RuntimeException ("Check failure!");
}
-
+
if (journal.getCurrentFile() == file)
{
throw new RuntimeException ("Check failure! Current file listed as data file!");
}
-
+
seq = file.getFileID();
}
-
+
long lastFreeId = -1;
for (JournalFile file : freeFiles)
{
@@ -342,18 +342,18 @@
log.info("CheckDataFiles:");
log.info(debugFiles());
log.info("FreeFileID out of order ");
-
+
throw new RuntimeException ("Check failure!");
}
-
+
lastFreeId= file.getFileID();
-
+
if (file.getFileID() < seq)
{
log.info("CheckDataFiles:");
log.info(debugFiles());
log.info("A FreeFile is less then the maximum data");
-
+
// throw new RuntimeException ("Check failure!");
}
}
@@ -362,7 +362,7 @@
public void addDataFileOnBottom(final JournalFile file)
{
dataFiles.add(file);
-
+
if (CHECK_CONSISTENCE)
{
checkDataFiles();
@@ -436,14 +436,14 @@
log.trace("openedFiles.size() = " + openedFiles.size());
log.trace("minfiles = " + minFiles);
log.trace("Free Files = " + freeFiles.size());
- log.trace("File " + file +
- " being deleted as freeFiles.size() + dataFiles.size() + 1 + openedFiles.size() (" +
- (freeFiles.size() + dataFiles.size() + 1 + openedFiles.size()) +
+ log.trace("File " + file +
+ " being deleted as freeFiles.size() + dataFiles.size() + 1 + openedFiles.size() (" +
+ (freeFiles.size() + dataFiles.size() + 1 + openedFiles.size()) +
") < minFiles (" + minFiles + ")" );
}
file.getFile().delete();
}
-
+
if (CHECK_CONSISTENCE)
{
checkDataFiles();
@@ -521,7 +521,10 @@
JournalFilesRepository.trace("pushing openFile " + nextOpenedFile);
}
- openedFiles.offer(nextOpenedFile);
+ if (!openedFiles.offer(nextOpenedFile))
+ {
+ log.warn("Failed to add file to openedFiles queue: " + nextOpenedFile + ". This should NOT happen!");
+ }
}
public void closeFile(final JournalFile file) throws Exception
13 years
JBoss hornetq SVN: r12198 - trunk/etc.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-27 10:02:43 -0500 (Mon, 27 Feb 2012)
New Revision: 12198
Modified:
trunk/etc/findbugs-exclude.xml
Log:
findbugs: Correct filter rules.
Modified: trunk/etc/findbugs-exclude.xml
===================================================================
--- trunk/etc/findbugs-exclude.xml 2012-02-24 21:19:02 UTC (rev 12197)
+++ trunk/etc/findbugs-exclude.xml 2012-02-27 15:02:43 UTC (rev 12198)
@@ -20,14 +20,26 @@
<Or>
<Method name="compare" params="java.lang.Integer,java.lang.Integer" returns="boolean"/>
<Method name="compare" params="java.lang.Long,java.lang.Long" returns="boolean"/>
- <Method name="compare" params="java.lang.String,java.lang.String" returns="boolean"/>
- <Method name="compare" params="java.lang.Boolean,java.lang.Boolean" returns="boolean"/>
<Method name="compare" params="java.lang.Double,java.lang.Double" returns="boolean"/>
</Or>
<Bug pattern="RC_REF_COMPARISON"/>
</Match>
+ <!-- Comparison is correct within its context -->
<Match>
+ <Class name="org.hornetq.ra.Util"/>
+ <Method name="compare" params="java.lang.Boolean,java.lang.Boolean" returns="boolean"/>
+ <Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN"/>
+ </Match>
+
+ <!-- Comparison is correct within its context -->
+ <Match>
+ <Class name="org.hornetq.ra.Util"/>
+ <Method name="compare" params="java.lang.String,java.lang.String" returns="boolean"/>
+ <Bug pattern="ES_COMPARING_PARAMETER_STRING_WITH_EQ"/>
+ </Match>
+
+ <Match>
<!-- As per Java Messaging Specification 3.5.4:
"
13 years
JBoss hornetq SVN: r12197 - branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/client.
by do-not-reply@jboss.org
Author: clebert.suconic
Date: 2012-02-24 16:19:02 -0500 (Fri, 24 Feb 2012)
New Revision: 12197
Modified:
branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/client/PagingTest.java
Log:
fixing test
Modified: branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/client/PagingTest.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2012-02-24 21:18:06 UTC (rev 12196)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2012-02-24 21:19:02 UTC (rev 12197)
@@ -259,6 +259,8 @@
Thread.sleep(100);
}
assertFalse(queue.getPageSubscription().getPagingStore().isPaging());
+
+ server.stop();
}
public void testPreparePersistent() throws Exception
13 years