org.apache.commons.lang3.concurrent.ConcurrentException源码实例Demo

类org.apache.commons.lang3.concurrent.ConcurrentException源码实例Demo

下面列出了org.apache.commons.lang3.concurrent.ConcurrentException 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jhdf   文件: ChunkedDatasetBase.java
private byte[] decompressChunk(Chunk chunk) {
    // Get the encoded (i.e. compressed buffer)
    final ByteBuffer encodedBuffer = getDataBuffer(chunk);

    // Get the encoded data from buffer
    final byte[] encodedBytes = new byte[encodedBuffer.remaining()];
    encodedBuffer.get(encodedBytes);

    try {
        final FilterPipeline pipeline = this.lazyPipeline.get();

        if (pipeline == null) {
            // No filters
            logger.debug("No filters returning decoded chunk '{}'", chunk);
            return encodedBytes;
        }

        // Decode using the pipeline applying the filters
        final byte[] decodedBytes = pipeline.decode(encodedBytes);
        logger.debug("Decoded {}", chunk);

        return decodedBytes;
    } catch (ConcurrentException e) {
        throw new HdfException("Failed to get filter pipeline", e);
    }
}
 
源代码2 项目: jhdf   文件: ObjectHeaderTest.java
@Test
void testLazyObjectHeader() throws ConcurrentException, IOException {
	FileChannel spyFc = Mockito.spy(fc);
	HdfFileChannel hdfFileChannel = new HdfFileChannel(spyFc, sb);
	LazyInitializer<ObjectHeader> lazyObjectHeader = ObjectHeader.lazyReadObjectHeader(hdfFileChannel, 10904); // int8
	// header
	// Creating the lazy object header should not touch the file
	Mockito.verifyNoInteractions(spyFc);

	// Get the actual header should cause the file to be read
	lazyObjectHeader.get();

	// Check the file was read
	verify(spyFc, Mockito.atLeastOnce()).read(any(ByteBuffer.class), anyLong());

	// Ensure nothing else was done to the file
	Mockito.verifyNoMoreInteractions(spyFc);
}
 
源代码3 项目: cassandra-reaper   文件: SegmentRunner.java
private void handlePotentialStuckRepairs(LazyInitializer<Set<String>> busyHosts, String hostName)
    throws ConcurrentException {

  if (!busyHosts.get().contains(hostName) && context.storage instanceof IDistributedStorage) {
    try {
      JmxProxy hostProxy = clusterFacade.connect(context.storage.getCluster(clusterName), Arrays.asList(hostName));

      // We double check that repair is still running there before actually cancelling repairs
      if (hostProxy.isRepairRunning()) {
        LOG.warn(
            "A host ({}) reported that it is involved in a repair, but there is no record "
                + "of any ongoing repair involving the host. Sending command to abort all repairs "
                + "on the host.",
            hostName);
        hostProxy.cancelAllRepairs();
      }
    } catch (ReaperException | RuntimeException | JMException e) {
      LOG.debug("failed to cancel repairs on host {}", hostName, e);
    }
  }
}
 
源代码4 项目: tutorials   文件: BuilderMethods.java
public static void main(final String[] arguments) {
    final BuilderMethods simple1 = new BuilderMethods(1, "The First One");
    System.out.println(simple1.getName());
    System.out.println(simple1.hashCode());
    System.out.println(simple1.toString());

    SampleLazyInitializer sampleLazyInitializer = new SampleLazyInitializer();

    try {
        sampleLazyInitializer.get();
    } catch (ConcurrentException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

    SampleBackgroundInitializer sampleBackgroundInitializer = new SampleBackgroundInitializer();
    sampleBackgroundInitializer.start();

    // Proceed with other tasks instead of waiting for the SampleBackgroundInitializer task to finish.

    try {
        Object result = sampleBackgroundInitializer.get();
    } catch (ConcurrentException e) {
        e.printStackTrace();
    }
}
 
源代码5 项目: vividus   文件: KeyStoreFactory.java
@Override
public Optional<KeyStore> getKeyStore()
{
    try
    {
        return cachedKeyStore.get();
    }
    catch (ConcurrentException e)
    {
        throw new IllegalStateException(e);
    }
}
 
源代码6 项目: jhdf   文件: ChunkedDatasetV4.java
@Override
protected Map<ChunkOffset, Chunk> getChunkLookup() {
    try {
        return chunkLookupLazyInitializer.get();
    } catch (ConcurrentException e) {
        throw new HdfException("Failed to create chunk lookup for: " + getPath(), e);
    }
}
 
源代码7 项目: jhdf   文件: ChunkedDatasetV3.java
@Override
protected Map<ChunkOffset, Chunk> getChunkLookup() {
    try {
        return chunkLookupLazyInitializer.get();
    } catch (ConcurrentException e) {
        throw new HdfException("Failed to create chunk lookup for: " + getPath(), e);
    }
}
 
源代码8 项目: jhdf   文件: AbstractNode.java
@Override
protected Map<String, Attribute> initialize() throws ConcurrentException {
	logger.debug("Lazy initializing attributes for '{}'", getPath());
	final ObjectHeader oh = lazyObjectHeader.get();

	List<AttributeMessage> attributeMessages = new ArrayList<>();

	if (oh.hasMessageOfType(AttributeInfoMessage.class)) {
		// Attributes stored in b-tree
		AttributeInfoMessage attributeInfoMessage = oh.getMessageOfType(AttributeInfoMessage.class);

		if (attributeInfoMessage.getFractalHeapAddress() != Constants.UNDEFINED_ADDRESS) {
			// Create the heap and btree
			FractalHeap fractalHeap = new FractalHeap(hdfFc, attributeInfoMessage.getFractalHeapAddress());
			BTreeV2<AttributeNameForIndexedAttributesRecord> btree = new BTreeV2<>(hdfFc,
					attributeInfoMessage.getAttributeNameBTreeAddress());

			// Read the attribute messages from the btree+heap
			for (AttributeNameForIndexedAttributesRecord attributeRecord : btree.getRecords()) {
				ByteBuffer bb = fractalHeap.getId(attributeRecord.getHeapId());
				AttributeMessage attributeMessage = new AttributeMessage(bb, hdfFc.getSuperblock(),
						attributeRecord.getFlags());
				logger.trace("Read attribute message '{}'", attributeMessage);
				attributeMessages.add(attributeMessage);
			}
		}
	}

	// Add the messages stored directly in the header
	attributeMessages.addAll(oh.getMessagesOfType(AttributeMessage.class));

	return attributeMessages.stream()
			.collect(
					toMap(AttributeMessage::getName,
							message -> new AttributeImpl(hdfFc, AbstractNode.this, message)));
}
 
源代码9 项目: jhdf   文件: GroupImpl.java
@Override
protected Map<String, Node> initialize() throws ConcurrentException {
	logger.info("Lazy loading children of '{}'", getPath());

	if (header.get().hasMessageOfType(SymbolTableMessage.class)) {
		// Its an old style Group
		return createOldStyleGroup(header.get());
	} else {
		return createNewStyleGroup(header.get());
	}
}
 
源代码10 项目: components   文件: BasicMetaDataImpl.java
public static BasicMetaDataImpl getInstance() {
    try {
        return initializer.get();
    } catch (ConcurrentException e) {
        throw new NetSuiteException("Initialization error", e);
    }
}
 
源代码11 项目: components   文件: BasicMetaDataImpl.java
public static BasicMetaDataImpl getInstance() {
    try {
        return initializer.get();
    } catch (ConcurrentException e) {
        throw new NetSuiteException("Initialization error", e);
    }
}
 
源代码12 项目: components   文件: BasicMetaDataImpl.java
public static BasicMetaDataImpl getInstance() {
    try {
        return initializer.get();
    } catch (ConcurrentException e) {
        throw new NetSuiteException("Initialization error", e);
    }
}
 
源代码13 项目: components   文件: BasicMetaDataImpl.java
public static BasicMetaDataImpl getInstance() {
    try {
        return initializer.get();
    } catch (ConcurrentException e) {
        throw new NetSuiteException("Initialization error", e);
    }
}
 
源代码14 项目: tutorials   文件: Lang3UtilsUnitTest.java
@Test
public void ConcurrentExceptionSample() throws ConcurrentException {
    final Error err = new AssertionError("Test");
    try {
        ConcurrentUtils.handleCause(new ExecutionException(err));
        fail("Error not thrown!");
    } catch (final Error e) {
        assertEquals("Wrong error", err, e);
    }
}
 
源代码15 项目: components   文件: BasicMetaDataImpl.java
@Override protected BasicMetaDataImpl initialize() throws ConcurrentException {
    return new BasicMetaDataImpl();
}
 
源代码16 项目: components   文件: BasicMetaDataImpl.java
@Override protected BasicMetaDataImpl initialize() throws ConcurrentException {
    return new BasicMetaDataImpl();
}
 
源代码17 项目: components   文件: BasicMetaDataImpl.java
@Override protected BasicMetaDataImpl initialize() throws ConcurrentException {
    return new BasicMetaDataImpl();
}
 
源代码18 项目: components   文件: BasicMetaDataImpl.java
@Override protected BasicMetaDataImpl initialize() throws ConcurrentException {
    return new BasicMetaDataImpl();
}
 
源代码19 项目: tutorials   文件: LazyInitializerUnitTest.java
@Test
public void givenLazyInitializerInstance_whenCalledget_thenCorrect() throws ConcurrentException {
    UserInitializer userInitializer = new UserInitializer();
    assertThat(userInitializer.get()).isInstanceOf(User.class);
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法