@Override public Locker apply(String lockerName) { String expectedManagerName = "com.thinkaurelius.titan.diskstorage.cassandra.astyanax.AstyanaxStoreManager"; String actualManagerName = storeManager.getClass().getCanonicalName(); // Require AstyanaxStoreManager Preconditions.checkArgument( expectedManagerName.equals(actualManagerName), "Astyanax Recipe locker is only supported with the Astyanax storage backend (configured:" + actualManagerName + " != required:" + expectedManagerName + ")"); try { Class<?> c = storeManager.getClass(); Method method = c.getMethod("openLocker", String.class); Object o = method.invoke(storeManager, lockerName); return (Locker) o; } catch (NoSuchMethodException e) { throw new IllegalArgumentException( "Could not find method when configuring locking with Astyanax Recipes"); } catch (IllegalAccessException e) { throw new IllegalArgumentException( "Could not access method when configuring locking with Astyanax Recipes", e); } catch (InvocationTargetException e) { throw new IllegalArgumentException( "Could not invoke method when configuring locking with Astyanax Recipes", e); } }