org.infinispan.commons.logging.Log.debugf()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(11.4k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.infinispan.commons.logging.Log.debugf()方法的一些代码示例,展示了Log.debugf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Log.debugf()方法的具体详情如下:
包路径:org.infinispan.commons.logging.Log
类名称:Log
方法名:debugf

Log.debugf介绍

暂无

代码示例

代码示例来源:origin: org.infinispan/infinispan-commons

private static <T> void addServices(ServiceLoader<T> loadedServices, Map<String, T> services) {
 Iterator<T> i = loadedServices.iterator();
 while (i.hasNext()) {
   try {
    T service = i.next();
    if (services.putIfAbsent(service.getClass().getName(), service) == null) {
      LOG.debugf("Loading service impl: %s", service.getClass().getName());
    } else {
      LOG.debugf("Ignoring already loaded service: %s", service.getClass().getName());
    }
   } catch (ServiceConfigurationError e) {
    LOG.debugf("Skipping service impl", e);
   }
 }
}

代码示例来源:origin: org.infinispan/infinispan-spring4-common

protected void emitSessionCreatedEvent(String sessionId) {
 logger.debugf("Emitting session created %s", sessionId);
 springEventsPublisher.ifPresent(p -> p.publishEvent(new SessionCreatedEvent(eventSource, sessionId)));
}

代码示例来源:origin: org.infinispan/infinispan-spring4-common

protected void emitSessionDestroyedEvent(String sessionId) {
 logger.debugf("Emitting session destroyed %s", sessionId);
 springEventsPublisher.ifPresent(p -> p.publishEvent(new SessionDestroyedEvent(eventSource, sessionId)));
}

代码示例来源:origin: org.infinispan/infinispan-spring4-common

protected void emitSessionDeletedEvent(String sessionId) {
 logger.debugf("Emitting session deleted %s", sessionId);
 springEventsPublisher.ifPresent(p -> p.publishEvent(new SessionDeletedEvent(eventSource, sessionId)));
}

代码示例来源:origin: org.infinispan/infinispan-spring4-common

protected void emitSessionExpiredEvent(String sessionId) {
 logger.debugf("Emitting session expired %s", sessionId);
 springEventsPublisher.ifPresent(p -> p.publishEvent(new SessionExpiredEvent(eventSource, sessionId)));
}

代码示例来源:origin: org.infinispan/infinispan-commons

public static void renameTempFile(File tempFile, File lockFile, File dstFile)
     throws IOException {
   FileLock lock = null;
   try (FileOutputStream lockFileOS = new FileOutputStream(lockFile)) {
     lock = lockFileOS.getChannel().lock();
     Files.move(tempFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
   } finally {
     if (lock != null && lock.isValid()) {
      lock.release();
     }
     if (!lockFile.delete()) {
      log.debugf("Unable to delete lock file %s", lockFile);
     }
   }
  }
}

代码示例来源:origin: org.infinispan/infinispan-commons

public static List<Class<?>> infinispanClasses(String javaClassPath) throws Exception {
 List<File> files = new ArrayList<>();
 // either infinispan jar or a directory of output classes contains infinispan classes
 for (String path : javaClassPath.split(File.pathSeparator)) {
   File file = new File(path);
   boolean isInfinispanJar = file.isFile() && file.getName().contains("infinispan");
   // Exclude the test utility classes in the commons-test module
   boolean isTargetDirectory = file.isDirectory() &&
      new File(file, "org/infinispan").isDirectory() &&
      !new File(file, "org/infinispan/commons/test").isDirectory();
   if (isInfinispanJar || isTargetDirectory) {
    files.add(file);
   }
 }
 log.debugf("Looking for infinispan classes in %s", files);
 if (files.isEmpty()) {
   return Collections.emptyList();
 } else {
   Set<Class<?>> classFiles = new HashSet<>();
   for (File file : files) {
    classFiles.addAll(findClassesOnPath(file));
   }
   return new ArrayList<>(classFiles);
 }
}

代码示例来源:origin: org.infinispan/infinispan-commons

public Features(ClassLoader classLoader) {
 features = new Properties();
 try {
   Enumeration<URL> featureFiles = classLoader.getResources(FEATURES_FILE);
   while (featureFiles.hasMoreElements()) {
    URL url = featureFiles.nextElement();
    try (InputStream is = url.openStream()) {
      features.load(is);
    }
   }
   if (log.isDebugEnabled()) {
    features.forEach((key, value) -> log.debugf("Feature %s=%s", key, value));
   }
 } catch (IOException e) {
   log.debugf(e, "Error while attempting to obtain `%s` resources from the classpath", FEATURES_FILE);
   throw new CacheConfigurationException(e);
 }
}

代码示例来源:origin: org.infinispan/infinispan-commons

private static <T> void addOsgiServices(Class<T> contract, Map<String, T> services) {
   if (!Util.isOSGiContext()) {
     return;
   }
   final BundleContext bundleContext = FrameworkUtil.getBundle(ServiceFinder.class).getBundleContext();
   final ServiceTracker<T, T> serviceTracker = new ServiceTracker<T, T>(bundleContext, contract.getName(),
      null);
   serviceTracker.open();
   try {
     final Object[] osgiServices = serviceTracker.getServices();
     if (osgiServices != null) {
      for (Object osgiService : osgiServices) {
        if (services.putIfAbsent(osgiService.getClass().getName(), (T) osgiService) == null) {
         LOG.debugf("Loading service impl: %s", osgiService.getClass().getSimpleName());
        } else {
         LOG.debugf("Ignoring already loaded service: %s", osgiService.getClass().getSimpleName());
        }
      }
     }
   } catch (Exception e) {
     // ignore
   }
  }
}

代码示例来源:origin: org.infinispan/infinispan-commons

/**
* Looks up the file, see : {@link DefaultFileLookup}.
*
* @param filename might be the name of the file (too look it up in the class path) or an url to a file.
* @return an input stream to the file or null if nothing found through all lookup steps.
* @throws FileNotFoundException if file cannot be found
*/
@Override
public InputStream lookupFileStrict(String filename, ClassLoader cl) throws FileNotFoundException {
 InputStream is = filename == null || filename.length() == 0 ? null : getAsInputStreamFromClassLoader(filename, cl);
 if (is == null) {
   if (log.isDebugEnabled())
    log.debugf("Unable to find file %s in classpath; searching for this file on the filesystem instead.", filename);
   return new FileInputStream(filename);
 }
 return is;
}

代码示例来源:origin: org.infinispan/infinispan-server-core

public static int findFreePort() {
 try {
   try (ServerSocket socket = new ServerSocket(0)) {
    return socket.getLocalPort();
   }
 } catch (IOException e) {
   LOG.debugf("Error finding free port, falling back to auto-generated port. Error message: ",
     e.getMessage());
 }
 return defaultUniquePort.incrementAndGet();
}

代码示例来源:origin: org.infinispan/infinispan-commons

public static <T> Collection<T> load(Class<T> contract, ClassLoader... loaders) {
 Map<String, T> services = new LinkedHashMap<>();
 if (loaders.length == 0) {
   try {
    ServiceLoader<T> loadedServices = ServiceLoader.load(contract);
    addServices(loadedServices, services);
   } catch (Exception e) {
    // Ignore
   }
 }
 else {
   for (ClassLoader loader : loaders) {
    if (loader == null)
      throw new NullPointerException();
    try {
      ServiceLoader<T> loadedServices = ServiceLoader.load(contract, loader);
      addServices(loadedServices, services);
    } catch (Exception e) {
      // Ignore
    }
   }
 }
 addOsgiServices( contract, services );
 if (services.isEmpty()) {
   LOG.debugf("No service impls found: %s", contract.getSimpleName());
 }
 return services.values();
}

代码示例来源:origin: org.infinispan/infinispan-commons

/**
* Register the given dynamic JMX MBean.
*
* @param mbean Dynamic MBean to register
* @param objectName {@link ObjectName} under which to register the MBean.
* @param mBeanServer {@link MBeanServer} where to store the MBean.
* @throws Exception If registration could not be completed.
*/
public static void registerMBean(Object mbean, ObjectName objectName, MBeanServer mBeanServer) throws Exception {
 if (!mBeanServer.isRegistered(objectName)) {
   try {
    SecurityActions.registerMBean(mbean, objectName, mBeanServer);
    log.tracef("Registered %s under %s", mbean, objectName);
   } catch (InstanceAlreadyExistsException e) {
    //this might happen if multiple instances are trying to concurrently register same objectName
    log.couldNotRegisterObjectName(objectName, e);
   }
 } else {
   log.debugf("Object name %s already registered", objectName);
 }
}

代码示例来源:origin: org.infinispan/infinispan-commons

@Test(expected = IllegalArgumentException.class)
public void testInvalidGlobalTransaction2() {
 long seed = System.currentTimeMillis();
 log.infof("[testInvalidGlobalTransaction2] seed: %s", seed);
 Random random = new Random(seed);
 byte[] globalTx = new byte[65]; //max is 64
 random.nextBytes(globalTx);
 Xid xid = XidImpl.create(random.nextInt(), globalTx, new byte[]{0});
 log.debugf("Invalid XID: %s", xid);
}

代码示例来源:origin: org.infinispan/infinispan-commons

@Test(expected = IllegalArgumentException.class)
public void testInvalidBranch() {
 long seed = System.currentTimeMillis();
 log.infof("[testInvalidBranch] seed: %s", seed);
 Random random = new Random(seed);
 Xid xid = XidImpl.create(random.nextInt(), new byte[]{0}, Util.EMPTY_BYTE_ARRAY);
 log.debugf("Invalid XID: %s", xid);
}

代码示例来源:origin: org.infinispan/infinispan-commons

@Test(expected = IllegalArgumentException.class)
public void testInvalidBranch2() {
 long seed = System.currentTimeMillis();
 log.infof("[testInvalidBranch2] seed: %s", seed);
 Random random = new Random(seed);
 byte[] branch = new byte[65]; //max is 64
 random.nextBytes(branch);
 Xid xid = XidImpl.create(random.nextInt(), new byte[]{0}, branch);
 log.debugf("Invalid XID: %s", xid);
}

代码示例来源:origin: org.infinispan/infinispan-commons

@Test(expected = IllegalArgumentException.class)
public void testInvalidGlobalTransaction() {
 long seed = System.currentTimeMillis();
 log.infof("[testInvalidGlobalTransaction] seed: %s", seed);
 Random random = new Random(seed);
 Xid xid = XidImpl.create(random.nextInt(), Util.EMPTY_BYTE_ARRAY, new byte[]{0});
 log.debugf("Invalid XID: %s", xid);
}

代码示例来源:origin: org.infinispan/infinispan-commons

@Test
public void testMarshalling() throws IOException, ClassNotFoundException {
 long seed = System.currentTimeMillis();
 log.infof("[testMarshalling] seed: %s", seed);
 Random random = new Random(seed);
 int formatId = random.nextInt();
 byte[] tx = new byte[random.nextInt(64) + 1];
 byte[] branch = new byte[random.nextInt(64) + 1];
 random.nextBytes(tx);
 random.nextBytes(branch);
 XidImpl xid = XidImpl.create(formatId, tx, branch);
 log.debugf("XID: %s", xid);
 ByteArrayOutputStream bos = new ByteArrayOutputStream(256);
 ObjectOutput oo = new ObjectOutputStream(bos);
 XidImpl.writeTo(oo, xid);
 oo.flush();
 oo.close();
 bos.close();
 byte[] marshalled = bos.toByteArray();
 log.debugf("Size: %s", marshalled.length);
 ByteArrayInputStream bis = new ByteArrayInputStream(marshalled);
 ObjectInput oi = new ObjectInputStream(bis);
 XidImpl otherXid = XidImpl.readFrom(oi);
 oi.close();
 bis.close();
 log.debugf("other XID: %s", xid);
 Assert.assertEquals(xid, otherXid);
}

代码示例来源:origin: org.infinispan/infinispan-commons

@Test
public void testCorrectDataStored() {
 long seed = System.currentTimeMillis();
 log.infof("[testCorrectDataStored] seed: %s", seed);
 Random random = new Random(seed);
 int formatId = random.nextInt();
 byte[] tx = new byte[random.nextInt(64) + 1];
 byte[] branch = new byte[random.nextInt(64) + 1];
 random.nextBytes(tx);
 random.nextBytes(branch);
 Xid xid = XidImpl.create(formatId, tx, branch);
 log.debugf("XID: %s", xid);
 Assert.assertEquals(formatId, xid.getFormatId());
 Assert.assertArrayEquals(tx, xid.getGlobalTransactionId());
 Assert.assertArrayEquals(branch, xid.getBranchQualifier());
 Xid sameXid = XidImpl.create(formatId, tx, branch);
 log.debugf("same XID: %s", sameXid);
 Assert.assertEquals(xid, sameXid);
}

代码示例来源:origin: org.infinispan/infinispan-commons

@Test
public void testCorrectDataStoredMaxSize() {
 long seed = System.currentTimeMillis();
 log.infof("[testCorrectDataStoredMaxSize] seed: %s", seed);
 Random random = new Random(seed);
 int formatId = random.nextInt();
 byte[] tx = new byte[Xid.MAXGTRIDSIZE];
 byte[] branch = new byte[Xid.MAXBQUALSIZE];
 random.nextBytes(tx);
 random.nextBytes(branch);
 Xid xid = XidImpl.create(formatId, tx, branch);
 log.debugf("XID: %s", xid);
 Assert.assertEquals(formatId, xid.getFormatId());
 Assert.assertArrayEquals(tx, xid.getGlobalTransactionId());
 Assert.assertArrayEquals(branch, xid.getBranchQualifier());
 Xid sameXid = XidImpl.create(formatId, tx, branch);
 log.debugf("same XID: %s", sameXid);
 Assert.assertEquals(xid, sameXid);
}

相关文章

微信公众号

最新文章

更多