function Incident() { var reset = false; this._dtasks = []; this.handlePropertyGet = function (ename) { if (reset) { this._dtasks = []; } else { this._dtasks = [1, 2, 3]; } return this._dtasks; }; Object.defineProperty(this, 'DTasks', { get: function () { return this.handlePropertyGet("DTasks"); }, enumerable: true }); } var x = new Incident(); console.log(x.DTasks);
@Override public void handle(Incident incident) throws Exception { synchronized (incidents) { boolean unique = true; Iterator<Incident> iter = incidents.iterator(); while (iter.hasNext()) { if (Strings.areEqual(iter.next().getLocation(), incident.getLocation())) { iter.remove(); unique = false; } } incidents.add(0, incident); numIncidents.inc(); if (unique) { numUniqueIncidents.inc(); } while (incidents.size() > maxErrors) { incidents.remove(incidents.size() - 1); } } }
var incident = new Incident();
private void notifyHandlers(HandledException result) { // Injector might not have run yet if (handlers == null || Boolean.TRUE.equals(frozen.get())) { return; } try { frozen.set(Boolean.TRUE); String location = computeLocation(result); for (ExceptionHandler handler : handlers) { try { handler.handle(new Incident(log.getName(), location, CallContext.getCurrent().getMDC(), result)); } catch (Exception e) { // Just log the exception - anything else might call a rather long infinite loop LOG.SEVERE(new Exception(Strings.apply( "An error occurred while calling the ExceptionHandler: %s - %s (%s)", handler, e.getMessage(), e.getClass().getName()), e)); } } } finally { frozen.set(Boolean.FALSE); } }
driverLocObj.PersonInfo = new PersonInfo(); driverLocObj.DriverLicense = new DriverLicense(); driverLocObj.Incident = new Incident(); return driverLocObj; },