/*
 * Copyright 2014 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.vertx;

import io.vertx.core.Vertx;

import java.util.concurrent.Executor;

/**
 * Vert.x execution context.
 *
 * @author <a href="http://github.com/kuujo">Jordan Halterman</a>
 */
public class VertxEventLoopExecutor implements Executor {
  private final Vertx vertx;

  public VertxEventLoopExecutor(Vertx vertx) {
    this.vertx = vertx;
  }

  @Override
  public void execute(Runnable command) {
    vertx.runOnContext(v -> command.run());
  }

}

@@ -634,24 +634,54 @@
 cat.vertx;%0A%0A
+import io.vertx.core.Context;%0A
 import io.ve
@@ -916,27 +916,31 @@
 e final 
-Vertx vertx
+Context context
 ;%0A%0A  pub
@@ -994,21 +994,23 @@
 his.
-vertx
+context
  = vertx
 ;%0A  
@@ -1005,16 +1005,37 @@
  = vertx
+.getOrCreateContext()
 ;%0A  %7D%0A%0A 
@@ -1091,21 +1091,23 @@
 ) %7B%0A    
-vertx
+context
 .runOnCo

Refactor Vert.x 3 event loop context to store context upon construction in order to prevent issues with calling runOnContext from a non-context thread.