<commit_before>/*
 * Copyright (c) 2006 Digital Bazaar, Inc.  All rights reserved.
 */
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.Socket;

import com.db.logging.LoggerManager;
import com.db.logging.Logger;
import com.db.util.PortFileLock;
import com.db.util.PortFileLockConnectionHandler;
import com.db.util.SslPortFileLock;

/**
 * A unit test for the FileLock class.
 * 
 * @author <NAME>
 */
public class UTFileLock
{
   /**
    * Runs the FileLock test.
    * 
    * @param args the args.
    */
   public static void main(String[] args)
   {
      try
      {
         // set up logger
         LoggerManager.setFile("dbutil", "ut-filelock.log", false);
         LoggerManager.setFileVerbosity("dbutil", Logger.DETAIL_VERBOSITY);
         LoggerManager.setConsoleVerbosity("dbutil", Logger.ERROR_VERBOSITY);
         
         String filename = "lockfile.lock";
         
         // get a file lock
         PortFileLock fileLock = new SslPortFileLock(filename);
         
         // set the connection handler
         TestPortFileLockConnectionHandler handler =
            new TestPortFileLockConnectionHandler(fileLock);
         fileLock.setConnectionHandler(handler);
         
         // lock the file
         if(fileLock.tryLock())
         {
            System.out.println("file lock acquired");
         }
         else<commit_msg>Updated lock test so that it has sample code for putting a lock file in a user's home directory.<commit_after>/*
 * Copyright (c) 2006 Digital Bazaar, Inc.  All rights reserved.
 */
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.Socket;

import com.db.logging.LoggerManager;
import com.db.logging.Logger;
import com.db.util.PortFileLock;
import com.db.util.PortFileLockConnectionHandler;
import com.db.util.SslPortFileLock;

/**
 * A unit test for the FileLock class.
 * 
 * @author <NAME>
 */
public class UTFileLock
{
   /**
    * Runs the FileLock test.
    * 
    * @param args the args.
    */
   public static void main(String[] args)
   {
      try
      {
         // set up logger
         LoggerManager.setFile("dbutil", "ut-filelock.log", false);
         LoggerManager.setFileVerbosity("dbutil", Logger.DETAIL_VERBOSITY);
         LoggerManager.setConsoleVerbosity("dbutil", Logger.ERROR_VERBOSITY);
         
         //String path = System.getProperty("user.home") + java.io.File.separator;
         //String filename = path + "lockfile.lock";
         String filename = "lockfile.lock";
         
         // get a file lock
         PortFileLock fileLock = new SslPortFileLock(filename);
         
         // set the connection handler
         TestPortFileLockConnectionHandler handler =
            new TestPortFileLockConnectionHandler(fileLock);
         fileLock.setConnectionHandler(handler);
         
         // lock the file
         if(fileLock.tryLock())
         {
            System.out.println("file lock acquired");
         }
         else
{'fraction_non_alphanumeric': 0.1008347245409015, 'fraction_numerical': 0.002671118530884808, 'mean_word_length': 2.3891402714932126, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5977785', 'n_tokens_mistral': 865, 'n_tokens_neox': 853, 'n_words': 205}