[
https://issues.apache.org/jira/browse/ARTEMIS-2336?focusedWorklogId=243993&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-243993
]
ASF GitHub Bot logged work on ARTEMIS-2336:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 17/May/19 12:21
Start Date: 17/May/19 12:21
Worklog Time Spent: 10m
Work Description: wy96f commented on pull request #2666: ARTEMIS-2336 Use
zero copy to replicate journal/page/large message file
URL: https://github.com/apache/activemq-artemis/pull/2666#discussion_r285101658
##########
File path:
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java
##########
@@ -274,67 +276,103 @@ private void waitForFailOver(String timeoutMsg) {
}
}
- // This must never called by more than one thread concurrently
- private boolean send(final Packet packet, final int reconnectID, final
boolean flush, final boolean batch) {
- if (invokeInterceptors(packet, interceptors, connection) != null) {
- return false;
+ private ActiveMQBuffer beforeSend(final Packet packet, final int
reconnectID) {
+ packet.setChannelID(id);
+
+ if (responseAsyncCache != null && packet.isRequiresResponse() &&
packet.isResponseAsync()) {
+ packet.setCorrelationID(responseAsyncCache.nextCorrelationID());
}
- synchronized (sendLock) {
- packet.setChannelID(id);
+ if (logger.isTraceEnabled()) {
+ logger.trace("RemotingConnectionID=" + (connection == null ? "NULL" :
connection.getID()) + " Sending packet nonblocking " + packet + " on
channelID=" + id);
+ }
- if (responseAsyncCache != null && packet.isRequiresResponse() &&
packet.isResponseAsync()) {
- packet.setCorrelationID(responseAsyncCache.nextCorrelationID());
+ ActiveMQBuffer buffer = packet.encode(connection);
+
+ lock.lock();
+
+ try {
+ if (failingOver) {
+ waitForFailOver("RemotingConnectionID=" + (connection == null ?
"NULL" : connection.getID()) + " timed-out waiting for fail-over condition on
non-blocking send");
}
- if (logger.isTraceEnabled()) {
- logger.trace("RemotingConnectionID=" + (connection == null ?
"NULL" : connection.getID()) + " Sending packet nonblocking " + packet + " on
channelID=" + id);
+ // Sanity check
+ if (transferring) {
+ throw
ActiveMQClientMessageBundle.BUNDLE.cannotSendPacketDuringFailover();
}
- ActiveMQBuffer buffer = packet.encode(connection);
+ if (resendCache != null && packet.isRequiresConfirmations()) {
+ addResendPacket(packet);
+ }
- lock.lock();
+ } finally {
+ lock.unlock();
+ }
- try {
- if (failingOver) {
- waitForFailOver("RemotingConnectionID=" + (connection == null ?
"NULL" : connection.getID()) + " timed-out waiting for fail-over condition on
non-blocking send");
- }
+ if (logger.isTraceEnabled()) {
+ logger.trace("RemotingConnectionID=" + (connection == null ? "NULL" :
connection.getID()) + " Writing buffer for channelID=" + id);
+ }
- // Sanity check
- if (transferring) {
- throw
ActiveMQClientMessageBundle.BUNDLE.cannotSendPacketDuringFailover();
- }
+ checkReconnectID(reconnectID);
- if (resendCache != null && packet.isRequiresConfirmations()) {
- addResendPacket(packet);
+ //We do this outside the lock as ResponseCache is threadsafe and allows
responses to come in,
+ //As the send could block if the response cache cannot add, preventing
responses to be handled.
+ if (responseAsyncCache != null && packet.isRequiresResponse() &&
packet.isResponseAsync()) {
+ while (!responseAsyncCache.add(packet)) {
+ try {
+ Thread.sleep(1);
+ } catch (Exception e) {
+ // Ignore
Review comment:
It seems responseAsyncCache::add always returns true, so the sleep code
doesn't make sense?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 243993)
Time Spent: 6h 20m (was: 6h 10m)
> Use zero copy to replicate journal/page/large message file
> ----------------------------------------------------------
>
> Key: ARTEMIS-2336
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2336
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Components: Broker
> Reporter: yangwei
> Priority: Major
> Time Spent: 6h 20m
> Remaining Estimate: 0h
>
> Use sendfile to replicate files during backup sever bootstrap.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)