public CellNucleus(Cell cell, String name, String type) { setPinboard(new Pinboard(PINBOARD_DEFAULT_SIZE)); if (__cellGlue == null) { // // the cell gluon hasn't yet been created // (we insist in creating a SystemCell first.) // if (cell instanceof SystemCell) { __cellGlue = new CellGlue(name); _cellName = "System"; _cellType = "System"; __cellGlue.setSystemNucleus(this); } else { throw new IllegalArgumentException("System must be first Cell"); } } else { // // we don't accept more then one System.cells // if (cell instanceof SystemCell) { throw new IllegalArgumentException("System already exists"); } else { String cellName = name.replace('@', '+'); if ((cellName == null) || (cellName.equals(""))) { cellName = "*"; } if (cellName.charAt(cellName.length() - 1) == '*') { if (cellName.length() == 1) { cellName = "$-" + getUnique(); } else { cellName = cellName.substring(0, cellName.length() - 1) + "-" + getUnique(); } } _cellName = cellName; _cellType = type; } } _cell = cell; _cellClass = _cell.getClass().getName(); /* Instantiate management component for log filtering. */ CellNucleus parentNucleus = CellNucleus.getLogTargetForCell(MDC.get(CDC.MDC_CELL)); FilterThresholds parentThresholds = (parentNucleus.isSystemNucleus() || parentNucleus == this) ? RootFilterThresholds.getInstance() : parentNucleus.getLoggingThresholds(); setLoggingThresholds(new FilterThresholds(parentThresholds)); // // for the use in restricted sandboxes // try { _threads = new ThreadGroup(__cellGlue.getMasterThreadGroup(), _cellName + "-threads"); } catch (SecurityException se) { _threads = null; } _callbackExecutor = new ThreadPoolExecutor( 1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), this); _messageExecutor = new ThreadPoolExecutor( 1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), this); _state = ACTIVE; // // make ourself known to the world // __cellGlue.addCell(_cellName, this); LOGGER.info("Created {}", name); }
void setSystemNucleus(CellNucleus nucleus) { __cellGlue.setSystemNucleus(nucleus); }