Package net.windwards.dnsfrontend.api

Examples of net.windwards.dnsfrontend.api.Backend


            this.refuse();
            return;
        }

        Record question = this.query.getMessage().getQuestion();
        Backend backend = this.backends.lookup(question.getType());

        if (backend == null) {
            this.refuse();
            return;
        }

        this.ident = backend.makeKey(question);

        logger.debug("Checking cache [key={}]", this.ident);

        // check cache
        Element lmnt = this.cache.get(this.getIdent());
        if(lmnt != null) {
            if(lmnt.getObjectValue() == DontExist) {
                this.timeout();
            } else {
                Record record = (Record) lmnt.getObjectValue();
                this.answer(record, true);
            }
            return;
        }

        logger.debug("Asking backend [query={}]", this.query);

        // Park this query awaiting result from backend
        this.waitHere.keep(this);
        try {
            // Notify backend we need an update
            backend.notify(question);
        } catch (NoSuchDomainException e) {
            this.waitHere.discard(this);
            this.unknown();
        } catch (BackendCommunicationException e) {
            this.waitHere.discard(this);
View Full Code Here


    public ResolveTaskFactory(Ehcache cache, AbstractTaskKeeper keeper, Configuration configuration) throws TextParseException {
        this.cache = cache;
        this.keeper = keeper;

        Backend jgroups = new JGroupsBackend();
        this.backends.put(Type.A, jgroups);
        this.backends.put(Type.AAAA, jgroups);
        MXRecord mx = new MXRecord(
                new Name("example.com."), DClass.IN, 30,
                1, new Name(configuration.getMX()));
View Full Code Here

            pack = this.futures.remove(lmnt.getObjectKey());
            pack.task.timeout();
            return;
        }

        Backend backend = this.repo.lookup(record.getType());
        String key = backend.makeKey(record);
        pack = this.futures.remove(key);

        if (pack == null) {
            logger.info("Unsolicited cache insert [key={}, record={}]", key, record);
            return;
View Full Code Here

        final List<Message> replies = new LinkedList<Message>();
        final Ehcache cache = TestUtils.getEhcache();
        Query query = TestUtils.getQuery(replies);

        final List<Record> pushed = new LinkedList<Record>();
        Backend backend = new TestingBackend(pushed);

        AbstractTaskKeeper zone = new AbstractTaskKeeper() {
            @Override public void start() { }
            @Override public void stop() { }
            @Override public void keep(ResolveTask task) { }
View Full Code Here

TOP

Related Classes of net.windwards.dnsfrontend.api.Backend

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.