35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
38 |
|
|
39 |
package gnu.java.nio; |
package gnu.java.nio; |
40 |
|
|
41 |
|
import java.io.FileDescriptor; |
42 |
|
import java.io.IOException; |
43 |
import java.nio.channels.FileChannel; |
import java.nio.channels.FileChannel; |
44 |
import java.nio.channels.FileLock; |
import java.nio.channels.FileLock; |
45 |
|
|
46 |
/** |
/** |
47 |
* @author Michael Koch |
* @author Michael Koch |
48 |
|
* @since 1.4 |
49 |
*/ |
*/ |
50 |
public class FileLockImpl extends FileLock |
public class FileLockImpl extends FileLock |
51 |
{ |
{ |
52 |
public FileLockImpl (FileChannel channel, long position, long size, |
private FileDescriptor fd; |
53 |
boolean shared) |
private boolean released; |
54 |
|
|
55 |
|
public FileLockImpl (FileDescriptor fd, FileChannel channel, long position, |
56 |
|
long size, boolean shared) |
57 |
{ |
{ |
58 |
super (channel, position, size, shared); |
super (channel, position, size, shared); |
59 |
|
this.fd = fd; |
60 |
|
this.released = false; |
61 |
} |
} |
62 |
|
|
63 |
public boolean isValid () |
public boolean isValid () |
64 |
{ |
{ |
65 |
throw new Error ("Not implemented"); |
return (released |
66 |
|
|| !channel ().isOpen ()); |
67 |
} |
} |
68 |
|
|
69 |
public void release () |
private native void releaseImpl () throws IOException; |
70 |
|
|
71 |
|
public synchronized void release () throws IOException |
72 |
{ |
{ |
73 |
throw new Error ("Not implemented"); |
releaseImpl (); |
74 |
|
released = true; |
75 |
} |
} |
76 |
} |
} |