diff --git a/resources/state-machine/src/main/java/net/kuujo/copycat/state/StateFactory.java b/resources/state-machine/src/main/java/net/kuujo/copycat/state/StateFactory.java
new file mode 100644
index 0000000000..d446dd9437
--- /dev/null
+++ b/resources/state-machine/src/main/java/net/kuujo/copycat/state/StateFactory.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.kuujo.copycat.state;
+
+/**
+ * State machine state factory.
+ *
+ * @author Jordan Halterman
+ */
+public interface StateFactory {
+
+ /**
+ * Creates a new state.
+ *
+ * @return A new state instance.
+ */
+ T createState();
+
+}
diff --git a/resources/state-machine/src/main/java/net/kuujo/copycat/state/StateMachine.java b/resources/state-machine/src/main/java/net/kuujo/copycat/state/StateMachine.java
index 16645ad5d5..1ce88d6875 100644
--- a/resources/state-machine/src/main/java/net/kuujo/copycat/state/StateMachine.java
+++ b/resources/state-machine/src/main/java/net/kuujo/copycat/state/StateMachine.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,70 +16,41 @@
package net.kuujo.copycat.state;
import net.kuujo.copycat.cluster.ClusterConfig;
-import net.kuujo.copycat.resource.ResourceContext;
-import net.kuujo.copycat.resource.internal.AbstractResource;
+import net.kuujo.copycat.resource.PartitionContext;
+import net.kuujo.copycat.resource.internal.AbstractPartitionedResource;
-import java.lang.reflect.*;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
-import java.util.stream.Collectors;
/**
* State machine.
*
* @author Jordan Halterman
*/
-public class StateMachine extends AbstractResource> {
-
- /**
- * Creates a new state machine with the given cluster and state machine configurations.
- *
- * @param config The state machine configuration.
- * @param cluster The cluster configuration.
- * @return A new state machine instance.
- */
- public static StateMachine create(T state, StateMachineConfig config, ClusterConfig cluster) {
- return new StateMachine<>(state, config, cluster);
- }
-
- /**
- * Creates a new state machine with the given cluster and state machine configurations.
- *
- * @param config The state machine configuration.
- * @param cluster The cluster configuration.
- * @param executor An executor on which to execute state machine callbacks.
- * @return A new state machine instance.
- */
- public static StateMachine create(T state, StateMachineConfig config, ClusterConfig cluster, Executor executor) {
- return new StateMachine<>(state, config, cluster, executor);
- }
-
- private T state;
- private final StateLog