It's allowed in that technically you can do it. However it isn't very advisable. Generally your servlet should be serving something up as a response to a request. If there are other tasks that need to be done you probably want them to be done outside of the servlet container, such that if the container has problems, or is restarted etc then your other tasks can carry on.
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.