/** * Get system info */ private static SimpleOrderedMap<Object> getCoreInfo( SolrCore core ) throws Exception { SimpleOrderedMap<Object> info = new SimpleOrderedMap<Object>(); IndexSchema schema = core.getSchema(); info.add( "schema", schema != null ? schema.getSchemaName():"no schema!" ); // Host InetAddress addr = InetAddress.getLocalHost(); info.add( "host", addr.getCanonicalHostName() ); // Now info.add( "now", new Date() ); // Start Time info.add( "start", new Date(core.getStartTime()) ); // Solr Home SimpleOrderedMap<Object> dirs = new SimpleOrderedMap<Object>(); dirs.add( "instance", new File( core.getResourceLoader().getInstanceDir() ).getAbsolutePath() ); dirs.add( "data", new File( core.getDataDir() ).getAbsolutePath() ); dirs.add( "index", new File( core.getIndexDir() ).getAbsolutePath() ); info.add( "directory", dirs ); return info; }
protected NamedList<Object> getCoreStatus(CoreContainer cores, String cname) throws IOException { NamedList<Object> info = new SimpleOrderedMap<Object>(); SolrCore core = cores.getCore(cname); if (core != null) { try { info.add("name", core.getName()); info.add("instanceDir", normalizePath(core.getResourceLoader().getInstanceDir())); info.add("dataDir", normalizePath(core.getDataDir())); info.add("startTime", new Date(core.getStartTime())); info.add("uptime", System.currentTimeMillis() - core.getStartTime()); RefCounted<SolrIndexSearcher> searcher = core.getSearcher(); try { info.add("index", LukeRequestHandler.getIndexInfo(searcher.get().getReader(), false)); } finally { searcher.decref(); } } finally { core.close(); } } return info; }