Merged in bbendukow/openesb-components/ESBCOMP-84-problem-if-you-are-using-samb (pull request #21)

ESBCOMP-84 fix
master
David Brassely 2014-01-14 09:16:45 +01:00
commit 3e9d6578a6
2 changed files with 42 additions and 1 deletions

View File

@ -1425,7 +1425,47 @@ public class OutboundMessageProcessor implements Runnable {
// sync threads across JVM (process) using physical file lock
// for accessing the target file
// blocking call
fileLock = cLock.getFileChannel().lock();
try {
fileLock = cLock.getFileChannel().lock();
} catch (IOException e) {
if (mLogger.isLoggable(Level.WARNING)) {
mLogger.log(Level.WARNING, "Exception caught when trying to lock file for outbound target: " + fileLock + ", destination file :" + outFile.getPath() + ". Trying to recreate. Exception: " + e.getMessage());
}
// So lets try to recreate lock for one time. Perhaps the service uses for NFS and external file storage got fail
LockRegistry.remove(endpointKey);
String lockName = null;
FileOutputStream fos = null;
File lockFile = null;
//write out info about this directory
lockName = endpoint.getFileAddress().getLockName();
lockName = lockName != null && lockName.trim().length() > 0 ? lockName : Lock.DEFAULT_INBOUND_LOCKFILE_NAME;
lockFile = new File(endpoint.getWorkAreaDir(), lockName);
lockFile.createNewFile();
fos = new FileOutputStream(lockFile);
if (mLogger.isLoggable(Level.FINE)) {
mLogger.log(Level.FINE, "FBD_Init_SU_Register_Lock",
new Object[]{lockFile.getCanonicalPath(), endpointKey});
}
Lock l = LockRegistry.register(endpointKey, new Lock((fos != null ? fos.getChannel() : null), new ReentrantLock(), lockFile.getCanonicalPath()));
if (l == null) {
throw new Exception(
mMessages.getString("FILEBC-E00793.Failed_register_lock_4_outbound_endpoint",
new Object[]{endpoint.getServiceName().toString(),
endpoint.getEndpointName(),
lockFile.getCanonicalPath()
}));
}
try {
cLock.setChannel(fos.getChannel());
fileLock = cLock.getFileChannel().lock();
} catch (Exception eee) {
mLogger.log(Level.SEVERE, "Exception caught when trying to lock file for outbound target: " + fileLock + ", destination file :" + outFile.getPath() + ", Exception: ("+e.getClass().getName()+")" + e.getMessage());
}
}
}
File path = outFile.getParentFile();

View File

@ -151,6 +151,7 @@ FILEBC-E00769.Failed_to_process_redelivery=FILEBC-E00769: An exception occured w
FileBC-E00790.Solicited_Read_Multiple_Records_Per_File=FileBC-E00790: Solicited Read does not support multiple records per file. Endpoint invoked was: {0}.
FILEBC-E00791.Solicited_Read_Failed=FILEBC-E00791: Solicited Read Failed. service: {0}, endpoint: {1}, operation: {2}. Error was: {3}.
FileBC-E00792.Solicited_Read_Could_Not_Send_Error_Message=FileBC-E00792: Solicited Read Failed. But error message could not be sent to the invoking service due to: {0}.
FILEBC-E00793.Failed_register_lock_4_outbound_endpoint=FILEBC-E00793: Failed to register lock file for outbound endpoint: service name = [{0}] endpoint name = [{1}], [{2}] might be used by an existing outbound endpoint.
# Warnings
FILEBC-W00701.Message_write_failed_exception=FILEBC-W00701: Attempt to write a message for service: {0}, endpoint: {1}, operation: {2}, failed. Error was: {3}