Search in sources :

Example 6 with PersisterException

use of com.mesosphere.sdk.storage.PersisterException in project dcos-commons by mesosphere.

the class CuratorPersister method set.

@Override
public void set(String unprefixedPath, byte[] bytes) throws PersisterException {
    final String path = withFrameworkPrefix(unprefixedPath);
    LOGGER.debug("Setting {} => {}", path, getInfo(bytes));
    try {
        try {
            client.create().creatingParentsIfNeeded().forPath(path, bytes);
        } catch (KeeperException.NodeExistsException e) {
            client.setData().forPath(path, bytes);
        }
    } catch (Exception e) {
        throw new PersisterException(Reason.STORAGE_ERROR, String.format("Unable to set %d bytes in %s", bytes.length, path), e);
    }
}
Also used : PersisterException(com.mesosphere.sdk.storage.PersisterException) KeeperException(org.apache.zookeeper.KeeperException) KeeperException(org.apache.zookeeper.KeeperException) PersisterException(com.mesosphere.sdk.storage.PersisterException)

Example 7 with PersisterException

use of com.mesosphere.sdk.storage.PersisterException in project dcos-commons by mesosphere.

the class SchemaVersionStoreTest method testCheckOtherFailure.

@Test(expected = StateStoreException.class)
public void testCheckOtherFailure() throws Exception {
    when(mockPersister.get(NODE_PATH)).thenThrow(new PersisterException(Reason.LOGIC_ERROR, "hey"));
    storeWithMock.check(3);
}
Also used : PersisterException(com.mesosphere.sdk.storage.PersisterException) Test(org.junit.Test)

Aggregations

PersisterException (com.mesosphere.sdk.storage.PersisterException)7 KeeperException (org.apache.zookeeper.KeeperException)3 Persister (com.mesosphere.sdk.storage.Persister)2 ApiServer (com.mesosphere.sdk.framework.ApiServer)1 FrameworkRunner (com.mesosphere.sdk.framework.FrameworkRunner)1 HealthResource (com.mesosphere.sdk.http.endpoints.HealthResource)1 PlansResource (com.mesosphere.sdk.http.endpoints.PlansResource)1 Phase (com.mesosphere.sdk.scheduler.plan.Phase)1 Plan (com.mesosphere.sdk.scheduler.plan.Plan)1 SerialStrategy (com.mesosphere.sdk.scheduler.plan.strategy.SerialStrategy)1 DefaultServiceSpec (com.mesosphere.sdk.specification.DefaultServiceSpec)1 ServiceSpec (com.mesosphere.sdk.specification.ServiceSpec)1 RawServiceSpec (com.mesosphere.sdk.specification.yaml.RawServiceSpec)1 FrameworkStore (com.mesosphere.sdk.state.FrameworkStore)1 SchemaVersionStore (com.mesosphere.sdk.state.SchemaVersionStore)1 PersisterCache (com.mesosphere.sdk.storage.PersisterCache)1 CuratorTransactionFinal (org.apache.curator.framework.api.transaction.CuratorTransactionFinal)1 Scheduler (org.apache.mesos.Scheduler)1 AbstractLifeCycle (org.eclipse.jetty.util.component.AbstractLifeCycle)1 LifeCycle (org.eclipse.jetty.util.component.LifeCycle)1