Package org.apache.wicket.util.time

Examples of org.apache.wicket.util.time.Duration


   */
  public ModificationWatcher getResourceWatcher(boolean start)
  {
    if (resourceWatcher == null && start)
    {
      final Duration pollFrequency = getResourcePollFrequency();
      if (pollFrequency != null)
      {
        resourceWatcher = new ModificationWatcher(pollFrequency);
      }
    }
View Full Code Here


  /**
   * Tests timer behavior in a component added to an AjaxRequestTarget
   */
  public void testAddToAjaxUpdate()
  {
    Duration dur = Duration.seconds(20);
    final MyAjaxSelfUpdatingTimerBehavior timer = new MyAjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();

    page.add(new WebComponent(MockPageWithLinkAndComponent.COMPONENT_ID).setOutputMarkupId(true));

View Full Code Here

  /**
   * tests timer behavior in a WebPage.
   */
  public void testAddToWebPage()
  {
    Duration dur = Duration.seconds(20);
    final MyAjaxSelfUpdatingTimerBehavior timer = new MyAjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();
    Label label = new Label(MockPageWithLinkAndComponent.COMPONENT_ID, "Hello");
    page.add(label);
    page.add(new Link(MockPageWithLinkAndComponent.LINK_ID)
View Full Code Here

        long startTime = System.currentTimeMillis();

        // TODO For now only use the setting. Might be extended with
        // something overridable on request/ page/ request target level
        // later
        Duration timeout = Application.get().getRequestCycleSettings().getTimeout();

        PageMapsUsedInRequestEntry entry = pageMapsUsedInRequest.get(pageMap);

        // Get page entry for id and version
        Thread t = entry != null ? entry.thread : null;
        while (t != null && t != Thread.currentThread())
        {
          if (isCurrentRequestValid(entry.requestCycle) == false)
          {
            // we need to ignore this request. That's because it is
            // an ajax request
            // while regular page request is being processed
            throw new IgnoreAjaxRequestException();
          }

          try
          {
            pageMapsUsedInRequest.wait(timeout.getMilliseconds());
          }
          catch (InterruptedException ex)
          {
            throw new WicketRuntimeException(ex);
          }

          entry = pageMapsUsedInRequest.get(pageMap);
          t = entry != null ? entry.thread : null;

          if (t != null && t != Thread.currentThread() &&
            (startTime + timeout.getMilliseconds()) < System.currentTimeMillis())
          {
            AppendingStringBuffer asb = new AppendingStringBuffer(100);
            asb.append("After " + timeout + " the Pagemap " + pageMapName +
              " is still locked by: " + t +
              ", giving up trying to get the page for path: " + path);
View Full Code Here

        long startTime = System.currentTimeMillis();

        // TODO For now only use the setting. Might be extended with
        // something overridable on request/ page/ request target level
        // later
        Duration timeout = Application.get().getRequestCycleSettings().getTimeout();

        PageMapsUsedInRequestEntry entry = (PageMapsUsedInRequestEntry)pageMapsUsedInRequest.get(pageMap);

        // Get page entry for id and version
        Thread t = entry != null ? entry.thread : null;
        while (t != null && t != Thread.currentThread())
        {
          if (isCurrentRequestValid(entry.requestCycle) == false)
          {
            // we need to ignore this request. That's because it is
            // an ajax request
            // while regular page request is being processed
            throw new IgnoreAjaxRequestException();
          }

          try
          {
            pageMapsUsedInRequest.wait(timeout.getMilliseconds());
          }
          catch (InterruptedException ex)
          {
            throw new WicketRuntimeException(ex);
          }

          entry = (PageMapsUsedInRequestEntry)pageMapsUsedInRequest.get(pageMap);
          t = entry != null ? entry.thread : null;

          if (t != null && t != Thread.currentThread() &&
            (startTime + timeout.getMilliseconds()) < System.currentTimeMillis())
          {
            // if it is still not the right thread..
            // This either points to long running code (a report
            // page?) or a deadlock or such
            throw new WicketRuntimeException("After " + timeout + " the Pagemap " +
View Full Code Here

      else if (AjaxRequestAttributes.EventPropagation.STOP_IMMEDIATE.equals(attributes.getEventPropagation()))
      {
        attributesJson.put(AjaxAttributeName.EVENT_PROPAGATION.jsonName(), "stopImmediate");
      }

      Duration requestTimeout = attributes.getRequestTimeout();
      if (requestTimeout != null)
      {
        attributesJson.put(AjaxAttributeName.REQUEST_TIMEOUT.jsonName(),
          requestTimeout.getMilliseconds());
      }

      boolean wicketAjaxResponse = attributes.isWicketAjaxResponse();
      if (wicketAjaxResponse == false)
      {
View Full Code Here

        long startTime = System.currentTimeMillis();

        // TODO For now only use the setting. Might be extended with
        // something overridable on request/ page/ request target level
        // later
        Duration timeout = Application.get().getRequestCycleSettings().getTimeout();

        PageMapsUsedInRequestEntry entry = pageMapsUsedInRequest.get(pageMap);

        // Get page entry for id and version
        Thread t = entry != null ? entry.thread : null;
        while (t != null && t != Thread.currentThread())
        {
          if (isCurrentRequestValid(entry.requestCycle) == false)
          {
            // we need to ignore this request. That's because it is
            // an ajax request
            // while regular page request is being processed
            throw new IgnoreAjaxRequestException();
          }

          try
          {
            pageMapsUsedInRequest.wait(timeout.getMilliseconds());
          }
          catch (InterruptedException ex)
          {
            throw new WicketRuntimeException(ex);
          }

          entry = pageMapsUsedInRequest.get(pageMap);
          t = entry != null ? entry.thread : null;

          if (t != null && t != Thread.currentThread() &&
            (startTime + timeout.getMilliseconds()) < System.currentTimeMillis())
          {
            AppendingStringBuffer asb = new AppendingStringBuffer(100);
            asb.append("After " + timeout + " the Pagemap " + pageMapName +
              " is still locked by: " + t +
              ", giving up trying to get the page for path: " + path);
View Full Code Here

  /**
   * @see org.apache.wicket.jmx.ResourceSettingsMBean#getResourcePollFrequency()
   */
  public String getResourcePollFrequency()
  {
    Duration duration = application.getResourceSettings().getResourcePollFrequency();
    return (duration != null) ? duration.toString() : null;
  }
View Full Code Here

        long startTime = System.currentTimeMillis();

        // TODO For now only use the setting. Might be extended with
        // something overridable on request/ page/ request target level
        // later
        Duration timeout = Application.get().getRequestCycleSettings().getTimeout();

        PageMapsUsedInRequestEntry entry = (PageMapsUsedInRequestEntry)pageMapsUsedInRequest
            .get(pageMap);

        // Get page entry for id and version
        Thread t = entry != null ? entry.thread : null;
        while (t != null && t != Thread.currentThread())
        {
          if (isCurrentRequestValid(entry.requestCycle) == false)
          {
            // we need to ignore this request. That's because it is
            // an ajax request
            // while regular page request is being processed
            throw new IgnoreAjaxRequestException();
          }

          try
          {
            pageMapsUsedInRequest.wait(timeout.getMilliseconds());
          }
          catch (InterruptedException ex)
          {
            throw new WicketRuntimeException(ex);
          }

          entry = (PageMapsUsedInRequestEntry)pageMapsUsedInRequest.get(pageMap);
          t = entry != null ? entry.thread : null;

          if (t != null && t != Thread.currentThread()
              && (startTime + timeout.getMilliseconds()) < System.currentTimeMillis())
          {
            // if it is still not the right thread..
            // This either points to long running code (a report
            // page?) or a deadlock or such
            throw new WicketRuntimeException("After " + timeout + " the Pagemap "
View Full Code Here

   */
  public ModificationWatcher getResourceWatcher(boolean start)
  {
    if (resourceWatcher == null && start)
    {
      final Duration pollFrequency = getResourcePollFrequency();
      if (pollFrequency != null)
      {
        resourceWatcher = new ModificationWatcher(pollFrequency);
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.time.Duration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.