From e5db06e22355d2ed5ee8d077eb5e27ada5b59b79 Mon Sep 17 00:00:00 2001 From: Boris Bendyukov Date: Tue, 14 Jan 2014 06:22:03 +0000 Subject: [PATCH 2/3] OutboundMessageProcessor.java edited online with Bitbucket --- .../jbi/filebc/OutboundMessageProcessor.java | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/ojc-core/filebc/filebcimpl/src/com/sun/jbi/filebc/OutboundMessageProcessor.java b/ojc-core/filebc/filebcimpl/src/com/sun/jbi/filebc/OutboundMessageProcessor.java index 6abfd3e90..9308574ac 100755 --- a/ojc-core/filebc/filebcimpl/src/com/sun/jbi/filebc/OutboundMessageProcessor.java +++ b/ojc-core/filebc/filebcimpl/src/com/sun/jbi/filebc/OutboundMessageProcessor.java @@ -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(); From 2d598dae81ef5f4116d8ae7e441b21486bd4ba1a Mon Sep 17 00:00:00 2001 From: Boris Bendyukov Date: Tue, 14 Jan 2014 06:23:41 +0000 Subject: [PATCH 3/3] Bundle.properties edited online with Bitbucket --- .../filebcimpl/src/com/sun/jbi/filebc/messages/Bundle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/ojc-core/filebc/filebcimpl/src/com/sun/jbi/filebc/messages/Bundle.properties b/ojc-core/filebc/filebcimpl/src/com/sun/jbi/filebc/messages/Bundle.properties index 125658ddb..78d37862b 100755 --- a/ojc-core/filebc/filebcimpl/src/com/sun/jbi/filebc/messages/Bundle.properties +++ b/ojc-core/filebc/filebcimpl/src/com/sun/jbi/filebc/messages/Bundle.properties @@ -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}