[teiid-commits] teiid SVN: r1151 - trunk/embedded/src/main/java/com/metamatrix/jdbc.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Fri Jul 17 17:38:57 EDT 2009
Author: rareddy
Date: 2009-07-17 17:38:57 -0400 (Fri, 17 Jul 2009)
New Revision: 1151
Modified:
trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
Log:
TEIID-722
Modified: trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-07-17 21:28:33 UTC (rev 1150)
+++ trunk/embedded/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java 2009-07-17 21:38:57 UTC (rev 1151)
@@ -33,6 +33,7 @@
import java.net.InetAddress;
import java.net.URL;
import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
import java.util.Date;
import java.util.Properties;
@@ -96,6 +97,7 @@
private SocketTransport socketTransport;
private JMXUtil jmxServer;
private boolean restart = false;
+ private FileLock pidLock;
@Override
public ServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
@@ -205,7 +207,8 @@
try {
File f = new File(this.workspaceDirectory, "teiid_"+processName+".pid"); //$NON-NLS-1$ //$NON-NLS-2$
FileChannel channel = new RandomAccessFile(f, "rw").getChannel(); //$NON-NLS-1$
- return (channel.tryLock() == null);
+ this.pidLock = channel.tryLock();
+ return (this.pidLock == null);
} catch (Exception e) {
// ignore
}
@@ -371,6 +374,12 @@
this.init = false;
+ try {
+ this.pidLock.release();
+ } catch (IOException e) {
+ //ignore..
+ }
+
this.restart = restart;
}
}
More information about the teiid-commits
mailing list