congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
UpdateListenerHub
Code IndexAdd Tabnine to your IDE (free)

How to use
UpdateListenerHub
in
org.apache.tapestry5.services

Best Java code snippets using org.apache.tapestry5.services.UpdateListenerHub (Showing top 11 results out of 315)

origin: apache/tapestry-5

public static ComponentMessagesSource buildComponentMessagesSource(UpdateListenerHub updateListenerHub, @Autobuild
ComponentMessagesSourceImpl service)
{
  updateListenerHub.addUpdateListener(service);
  return service;
}
origin: apache/tapestry-5

  public void run()
  {
    // On a race condition, multiple threads may hit this method briefly. If we've
    // already done a check, don't run it again.
    if (System.currentTimeMillis() - lastCheck >= checkInterval)
    {
      // Fire the update event which will force a number of checks and then
      // corresponding invalidation events.
      updateListenerHub.fireCheckForUpdates();
      lastCheck = System.currentTimeMillis();
    }
  }
};
origin: apache/tapestry-5

@PostInjection
public void registerAsUpdateListener(UpdateListenerHub hub)
{
  hub.addUpdateListener(this);
}
origin: apache/tapestry-5

/**
 * This allows tests the exists() method.
 */
@Test
public void component_class_reload() throws Exception
{
  // Ensure it doesn't already exist:
  assertFalse(source.exists(SYNTH_COMPONENT_CLASSNAME));
  // Create the class on the fly.
  createSynthComponentClass("Original");
  assertTrue(source.exists(SYNTH_COMPONENT_CLASSNAME));
  getMocksControl().resetToNice();
  Named named = (Named) createComponent(SYNTH_COMPONENT_CLASSNAME);
  assertEquals(named.getName(), "Original");
  long dtm = helper.readDTM(SYNTH_COMPONENT_CLASSNAME);
  while (true)
  {
    createSynthComponentClass("Updated");
    if (helper.readDTM(SYNTH_COMPONENT_CLASSNAME) != dtm)
      break;
    // Keep re-writing the file until we see the DTM change.
  }
  // Detect the change and clear out the internal caches
  UpdateListenerHub hub = registry.getService("UpdateListenerHub", UpdateListenerHub.class);
  hub.fireCheckForUpdates();
  // This will be the new version of the class
  named = (Named) createComponent(SYNTH_COMPONENT_CLASSNAME);
  assertEquals(named.getName(), "Updated");
}
origin: apache/tapestry-5

@PostInjection
public void registerWithUpdateListenerHub(UpdateListenerHub hub)
{
  hub.addUpdateListener(this);
}
origin: apache/tapestry-5

@PostInjection
public void registerAsUpdateListener(UpdateListenerHub hub)
{
  hub.addUpdateListener(this);
}
origin: apache/tapestry-5

private <T> T createReloadingProxy(Class<T> interfaceClass, final Class<? extends T> implementationClass,
                  ObjectLocator locator)
{
  ReloadableObjectCreator creator = new ReloadableObjectCreator(proxyFactory, implementationClass.getClassLoader(),
      implementationClass.getName(), loggerSource.getLogger(implementationClass), this, locator);
  getService(UpdateListenerHub.class).addUpdateListener(creator);
  return proxyFactory.createProxy(interfaceClass, implementationClass, (ObjectCreator<T>) creator,
      String.format("<Autoreload proxy %s(%s)>", implementationClass.getName(), interfaceClass.getName()));
}
origin: org.apache.tapestry/tapestry-ioc

private <T> T createReloadingProxy(Class<T> interfaceClass, final Class<? extends T> implementationClass,
                  ObjectLocator locator)
{
  ReloadableObjectCreator creator = new ReloadableObjectCreator(proxyFactory, implementationClass.getClassLoader(),
      implementationClass.getName(), loggerSource.getLogger(implementationClass), this, locator);
  getService(UpdateListenerHub.class).addUpdateListener(creator);
  return proxyFactory.createProxy(interfaceClass, implementationClass, (ObjectCreator<T>) creator,
      String.format("<Autoreload proxy %s(%s)>", implementationClass.getName(), interfaceClass.getName()));
}
origin: apache/tapestry-5

@PostInjection
public void listenForUpdates(UpdateListenerHub hub)
{
  invalidationHub.addInvalidationCallback(this);
  hub.addUpdateListener(this);
}
origin: org.apache.tapestry/tapestry-ioc

  private Object createReloadableProxy(ServiceBuilderResources resources)
  {
    ReloadableServiceImplementationObjectCreator reloadableCreator = new ReloadableServiceImplementationObjectCreator(proxyFactory,
        resources, proxyFactory.getClassLoader(), serviceImplementationClass.getName());

    resources.getService(UpdateListenerHub.class).addUpdateListener(reloadableCreator);

    if (eagerLoad)
    {
      reloadableCreator.createObject();
    }

    return proxyFactory.createProxy(serviceInterfaceClass, resources.getServiceImplementation(), reloadableCreator, getDescription());
  }
}
origin: apache/tapestry-5

  private Object createReloadableProxy(ServiceBuilderResources resources)
  {
    ReloadableServiceImplementationObjectCreator reloadableCreator = new ReloadableServiceImplementationObjectCreator(proxyFactory,
        resources, proxyFactory.getClassLoader(), serviceImplementationClass.getName());

    resources.getService(UpdateListenerHub.class).addUpdateListener(reloadableCreator);

    if (eagerLoad)
    {
      reloadableCreator.createObject();
    }

    return proxyFactory.createProxy(serviceInterfaceClass, resources.getServiceImplementation(), reloadableCreator, getDescription());
  }
}
org.apache.tapestry5.servicesUpdateListenerHub

Javadoc

Manages a set of org.apache.tapestry5.services.UpdateListeners. Periodically (say, every request during development, or every minute or so during production), request processing is locked down so that only a single thread is active, and the active thread invokes #fireCheckForUpdates(). Various services that are dependent on external resource files (such as classes or template files) can check to see if any file they've used has changed. If so, the service can invalidate its internal cache, or notify other services (typically via org.apache.tapestry5.services.InvalidationListener that they should do the same. Note that this interface has moved from module tapestry-core to tapestry-ioc, but has kept the same package (for backwards compatibility reasons). A weak reference to the listener is kept; this ensures that registering as a listener will not prevent a listener instance from being reclaimed by the garbage collector (this is useful as proxies created by ObjectLocator#proxy(Class,Class) may register as listeners, but still be ephemeral). Starting in Tapestry 5.3, this services does nothing in production mode.

Most used methods

  • addUpdateListener
    Adds a listener.
  • fireCheckForUpdates
    Invoked periodically to allow services to check if underlying state has changed. For example, a temp

Popular in Java

  • Parsing JSON documents to java classes using gson
  • putExtra (Intent)
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now