Codota Logo
Hostname
Code IndexAdd Codota to your IDE (free)

How to use
Hostname
in
com.ning.billing

Best Java code snippets using com.ning.billing.Hostname (Showing top 15 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: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public void recordFutureNotification(final DateTime futureNotificationTime, final NotificationEvent event, final UUID userToken, final Long searchKey1, final Long searchKey2) throws IOException {
  final String eventJson = objectMapper.writeValueAsString(event);
  final UUID futureUserToken = UUID.randomUUID();
  final Long searchKey2WithNull =  Objects.firstNonNull(searchKey2, new Long(0));
  final NotificationEventModelDao notification = new NotificationEventModelDao(Hostname.get(), clock.getUTCNow(), event.getClass().getName(), eventJson, userToken, searchKey1, searchKey2WithNull, futureUserToken, futureNotificationTime, getFullQName());
  dao.insertEntry(notification);
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public void recordFutureNotificationFromTransaction(final Transmogrifier transmogrifier, final DateTime futureNotificationTime, final NotificationEvent event,
                          final UUID userToken, final Long searchKey1, final Long searchKey2) throws IOException {
  final NotificationSqlDao transactionalNotificationDao = transmogrifier.become(NotificationSqlDao.class);
  final String eventJson = objectMapper.writeValueAsString(event);
  final UUID futureUserToken = UUID.randomUUID();
  final Long searchKey2WithNull =  Objects.firstNonNull(searchKey2, new Long(0));
  final NotificationEventModelDao notification = new NotificationEventModelDao(Hostname.get(), clock.getUTCNow(), event.getClass().getName(), eventJson, userToken, searchKey1, searchKey2WithNull, futureUserToken, futureNotificationTime, getFullQName());
  dao.insertEntryFromTransaction(transactionalNotificationDao, notification);
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

private List<T> fetchReadyEntries(int size) {
  final Date now = clock.getUTCNow().toDate();
  final List<T> entries = sqlDao.getReadyEntries(now, Hostname.get(), size, config.getTableName());
  return entries;
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public void post(final BusEvent event) throws EventBusException {
  try {
    if (isStarted.get()) {
      final String json = objectMapper.writeValueAsString(event);
      final BusEventModelDao entry = new BusEventModelDao(Hostname.get(), clock.getUTCNow(), event.getClass().getName(), json,
          event.getUserToken(), event.getSearchKey1(), event.getSearchKey2());
      dao.insertEntry(entry);
    } else {
      log.warn("Attempting to post event " + event + " in a non initialized bus");
    }
  } catch (Exception e) {
    log.error("Failed to post BusEvent " + event, e);
  }
}
origin: com.ning.billing.commons/killbill-queue

public MockNotificationQueue(final Clock clock, final String svcName, final String queueName, final NotificationQueueHandler handler, final MockNotificationQueueService mockNotificationQueueService) {
  this.svcName = svcName;
  this.queueName = queueName;
  this.handler = handler;
  this.clock = clock;
  this.hostname = Hostname.get();
  this.queueService = mockNotificationQueueService;
  this.recordIds = new AtomicLong();
  notifications = new TreeSet<NotificationEventModelDao>(new Comparator<NotificationEventModelDao>() {
    @Override
    public int compare(final NotificationEventModelDao o1, final NotificationEventModelDao o2) {
      if (o1.getEffectiveDate().equals(o2.getEffectiveDate())) {
        return o1.getRecordId().compareTo(o2.getRecordId());
      } else {
        return o1.getEffectiveDate().compareTo(o2.getEffectiveDate());
      }
    }
  });
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

private boolean claimEntry(T entry) {
  final Date nextAvailable = clock.getUTCNow().plus(config.getClaimedTime().getMillis()).toDate();
  final boolean claimed = (sqlDao.claimEntry(entry.getRecordId(), clock.getUTCNow().toDate(), Hostname.get(), nextAvailable, config.getTableName()) == 1);
  if (claimed && log.isDebugEnabled()) {
    log.debug(DB_QUEUE_LOG_ID + "Claiming entry " + entry.getRecordId());
  }
  return claimed;
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

private void clearFailedNotification(final NotificationEventModelDao cleared) {
  NotificationEventModelDao processedEntry = new NotificationEventModelDao(cleared, Hostname.get(), clock.getUTCNow(), PersistentQueueEntryLifecycleState.FAILED);
  dao.moveEntryToHistory(processedEntry);
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

  @Override
  public void postFromTransaction(final BusEvent event, final Transmogrifier transmogrifier)
      throws EventBusException {
    try {
      final PersistentBusSqlDao transactional = transmogrifier.become(PersistentBusSqlDao.class);
      if (isStarted.get()) {
        final String json = objectMapper.writeValueAsString(event);
        final BusEventModelDao entry = new BusEventModelDao(Hostname.get(), clock.getUTCNow(), event.getClass().getName(), json,
            event.getUserToken(), event.getSearchKey1(), event.getSearchKey2());
        dao.insertEntryFromTransaction(transactional, entry);
      } else {
        log.warn("Attempting to post event " + event + " in a non initialized bus");
      }
    } catch (Exception e) {
      log.error("Failed to post BusEvent " + event, e);
    }
  }
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

private void clearNotification(final NotificationEventModelDao cleared) {
  NotificationEventModelDao processedEntry = new NotificationEventModelDao(cleared, Hostname.get(), clock.getUTCNow(), PersistentQueueEntryLifecycleState.PROCESSED);
  dao.moveEntryToHistory(processedEntry);
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public void removeNotificationFromTransaction(final Transmogrifier transmogrifier, final Long recordId) {
  final NotificationSqlDao transactional = transmogrifier.become(NotificationSqlDao.class);
  final NotificationEventModelDao existing = transactional.getByRecordId(recordId, config.getTableName());
  final NotificationEventModelDao removedEntry = new NotificationEventModelDao(existing, Hostname.get(), clock.getUTCNow(), PersistentQueueEntryLifecycleState.REMOVED);
  dao.moveEntryToHistoryFromTransaction(transactional, removedEntry);
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public void removeNotification(final Long recordId) {
  final NotificationEventModelDao existing = dao.getSqlDao().getByRecordId(recordId, config.getTableName());
  final NotificationEventModelDao removedEntry = new NotificationEventModelDao(existing, Hostname.get(), clock.getUTCNow(), PersistentQueueEntryLifecycleState.REMOVED);
  dao.moveEntryToHistory(removedEntry);
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

} finally {
  if (lastException == null) {
    BusEventModelDao processedEntry = new BusEventModelDao(cur, Hostname.get(), clock.getUTCNow(), PersistentQueueEntryLifecycleState.PROCESSED);
    dao.moveEntryToHistory(processedEntry);
  } else if (errorCount <= config.getMaxFailureRetries()) {
    log.info("Bus dispatch error, will attempt a retry ", lastException);
    BusEventModelDao retriedEntry = new BusEventModelDao(cur, Hostname.get(), clock.getUTCNow(), PersistentQueueEntryLifecycleState.AVAILABLE, errorCount);
    dao.updateOnError(retriedEntry);
  } else {
    log.error("Fatal Bus dispatch error, data corruption...", lastException);
    BusEventModelDao processedEntry = new BusEventModelDao(cur, Hostname.get(), clock.getUTCNow(), PersistentQueueEntryLifecycleState.FAILED);
    dao.moveEntryToHistory(processedEntry);
origin: com.ning.billing/killbill-osgi-bundles-analytics

} else if (errorCount <= config.getMaxFailureRetries()) {
  log.info("NotificationQ dispatch error, will attempt a retry ", lastException);
  NotificationEventModelDao failedNotification = new NotificationEventModelDao(cur, Hostname.get(), clock.getUTCNow(), PersistentQueueEntryLifecycleState.AVAILABLE, errorCount);
  dao.updateOnError(failedNotification);
} else {
origin: com.ning.billing.commons/killbill-queue

final DateTime effDt = new DateTime();
final NotificationEventModelDao notif = new NotificationEventModelDao(Hostname.get(), clock.getUTCNow(), eventJson.getClass().getName(),
                                eventJson, UUID.randomUUID(), searchKey1, SEARCH_KEY_2,
                                UUID.randomUUID(), effDt, "testBasic");
NotificationEventModelDao notificationHistory = new NotificationEventModelDao(notification, Hostname.get(), processedTime, PersistentQueueEntryLifecycleState.PROCESSED);
dao.insertEntry(notificationHistory, notificationQueueConfig.getHistoryTableName());
assertEquals(notificationHistory.getEventJson(), eventJson);
validateDate(notificationHistory.getEffectiveDate(), effDt);
assertEquals(notificationHistory.getProcessingOwner(), Hostname.get());
assertEquals(notificationHistory.getProcessingState(), PersistentQueueEntryLifecycleState.PROCESSED);
validateDate(notificationHistory.getNextAvailableDate(), processedTime);
origin: com.ning.billing.commons/killbill-queue

private int doProcessEventsForQueue(final MockNotificationQueue queue) {
  int result = 0;
  final List<NotificationEventModelDao> processedNotifications = new ArrayList<NotificationEventModelDao>();
  final List<NotificationEventModelDao> oldNotifications = new ArrayList<NotificationEventModelDao>();
  List<NotificationEventModelDao> readyNotifications = queue.getReadyNotifications();
  for (final NotificationEventModelDao cur : readyNotifications) {
    final NotificationEvent key = deserializeEvent(cur.getClassName(), objectMapper, cur.getEventJson());
    queue.getHandler().handleReadyNotification(key, cur.getEffectiveDate(), cur.getFutureUserToken(), cur.getSearchKey1(), cur.getSearchKey2());
    final NotificationEventModelDao processedNotification = new NotificationEventModelDao(cur.getRecordId(), Hostname.get(), Hostname.get(), clock.getUTCNow(),
                                               getClock().getUTCNow().plus(CLAIM_TIME_MS),
                                               PersistentQueueEntryLifecycleState.PROCESSED, cur.getClassName(),
                                               cur.getEventJson(), 0L, cur.getUserToken(), cur.getSearchKey1(), cur.getSearchKey2(),
                                               cur.getFutureUserToken(), cur.getEffectiveDate(), "MockQueue");
    oldNotifications.add(cur);
    processedNotifications.add(processedNotification);
    result++;
  }
  queue.markProcessedNotifications(oldNotifications, processedNotifications);
  return result;
}
com.ning.billingHostname

Most used methods

  • get

Popular in Java

  • Making http requests using okhttp
  • findViewById (Activity)
  • getSystemService (Context)
  • addToBackStack (FragmentTransaction)
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
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