Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.nio.channels.FileLock createLockedStoreLockFileIn(java.nio.file.Path databaseDir) throws java.io.IOException
        private FileLock CreateLockedStoreLockFileIn(Path databaseDir)
        {
            Path storeLockFile = Files.createFile(DatabaseLayout.of(databaseDir.toFile()).StoreLayout.storeLockFile().toPath());

            _channel = FileChannel.open(storeLockFile, READ, WRITE);
            return(_channel.@lock(0, long.MaxValue, true));
        }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void main(String[] args) throws java.io.IOException
        public static void Main(string[] args)
        {
            Path path = Paths.get(args[0]);

            using (FileChannel channel = FileChannel.open(path, StandardOpenOption.READ, StandardOpenOption.WRITE), java.nio.channels.FileLock @lock = channel.@lock())
            {
                Console.WriteLine(LOCKED_OUTPUT);
                System.out.flush();
                Console.Read();
            }
        }