Codota Logo
UpdateListenerHub
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
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 registerAsUpdateListener(UpdateListenerHub hub)
{
  hub.addUpdateListener(this);
}
origin: apache/tapestry-5

@PostInjection
public void registerWithUpdateListenerHub(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

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • putExtra (Intent)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now