jdk/src/share/classes/sun/rmi/log/ReliableLog.java
changeset 23333 b0af2c7c8c91
parent 14342 8435a30053c1
equal deleted inserted replaced
23332:c36c4773fe96 23333:b0af2c7c8c91
    28 import java.io.*;
    28 import java.io.*;
    29 import java.lang.reflect.Constructor;
    29 import java.lang.reflect.Constructor;
    30 import java.rmi.server.RMIClassLoader;
    30 import java.rmi.server.RMIClassLoader;
    31 import java.security.AccessController;
    31 import java.security.AccessController;
    32 import java.security.PrivilegedAction;
    32 import java.security.PrivilegedAction;
    33 import sun.security.action.GetBooleanAction;
       
    34 import sun.security.action.GetPropertyAction;
       
    35 
    33 
    36 /**
    34 /**
    37  * This class is a simple implementation of a reliable Log.  The
    35  * This class is a simple implementation of a reliable Log.  The
    38  * client of a ReliableLog must provide a set of callbacks (via a
    36  * client of a ReliableLog must provide a set of callbacks (via a
    39  * LogHandler) that enables a ReliableLog to read and write
    37  * LogHandler) that enables a ReliableLog to read and write
   139                      boolean pad)
   137                      boolean pad)
   140         throws IOException
   138         throws IOException
   141     {
   139     {
   142         super();
   140         super();
   143         this.Debug = AccessController.doPrivileged(
   141         this.Debug = AccessController.doPrivileged(
   144             new GetBooleanAction("sun.rmi.log.debug")).booleanValue();
   142             (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("sun.rmi.log.debug"));
   145         dir = new File(dirPath);
   143         dir = new File(dirPath);
   146         if (!(dir.exists() && dir.isDirectory())) {
   144         if (!(dir.exists() && dir.isDirectory())) {
   147             // create directory
   145             // create directory
   148             if (!dir.mkdir()) {
   146             if (!dir.mkdir()) {
   149                 throw new IOException("could not create directory for log: " +
   147                 throw new IOException("could not create directory for log: " +
   332      **/
   330      **/
   333     private static Constructor<? extends LogFile>
   331     private static Constructor<? extends LogFile>
   334         getLogClassConstructor() {
   332         getLogClassConstructor() {
   335 
   333 
   336         String logClassName = AccessController.doPrivileged(
   334         String logClassName = AccessController.doPrivileged(
   337             new GetPropertyAction("sun.rmi.log.class"));
   335             (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.log.class"));
   338         if (logClassName != null) {
   336         if (logClassName != null) {
   339             try {
   337             try {
   340                 ClassLoader loader =
   338                 ClassLoader loader =
   341                     AccessController.doPrivileged(
   339                     AccessController.doPrivileged(
   342                         new PrivilegedAction<ClassLoader>() {
   340                         new PrivilegedAction<ClassLoader>() {